Permalink
Browse files

SERVER-2451 guard dropped cursor on explain yield

  • Loading branch information...
1 parent da3c2d6 commit 8330ff07664b1bbc1a966e5d224520872fbb245a @astaple astaple committed Feb 1, 2011
Showing with 9 additions and 5 deletions.
  1. +1 −0 db/query.cpp
  2. +8 −5 jstests/explain3.js
View
@@ -863,6 +863,7 @@ namespace mongo {
}
if ( _pq.isExplain() ) {
+ massert( 13638, "client cursor dropped during explain query yield", _c.get() );
_eb.noteScan( _c.get(), _nscanned, _nscannedObjects, _n, scanAndOrderRequired(),
_curop.elapsedMillis(), useHints && !_pq.getHint().eoo(), _nYields ,
_nChunkSkips, _keyFieldsOnly.get() > 0 );
View
@@ -1,8 +1,5 @@
/** SERVER-2451 Kill cursor while explain is yielding */
-// disable test until SERVER-2451 fixed
-if ( false ) {
-
t = db.jstests_explain3;
t.drop();
@@ -14,8 +11,14 @@ db.getLastError();
s = startParallelShell( "sleep( 20 ); db.jstests_explain3.dropIndex( {i:1} );" );
-printjson( t.find( {i:{$gt:-1},j:1} ).hint( {i:1} ).explain() );
+try {
+ t.find( {i:{$gt:-1},j:1} ).hint( {i:1} ).explain()
+} catch (e) {
+ print( "got exception" );
+ printjson( e );
+}
s();
-}
+// Sanity check to make sure mongod didn't seg fault.
+assert.eq( 10000, t.count() );

0 comments on commit 8330ff0

Please sign in to comment.