diff options
author | Aaron <aaron@10gen.com> | 2011-03-17 11:51:26 -0700 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2011-03-17 11:52:01 -0700 |
commit | d3a9fe9ae236b7b3013533453c0b33fd94051bb6 (patch) | |
tree | 76d5e08741c2ecc0145aff96bda0638fe9ed4e47 | |
parent | 783dc5a72155e2c73236f01490e5fc1b35968f79 (diff) | |
download | mongo-d3a9fe9ae236b7b3013533453c0b33fd94051bb6.tar.gz |
SERVER-2662 don't attempt to yield a query after an earlier yield fails and drops the cursor
-rw-r--r-- | db/query.cpp | 20 | ||||
-rw-r--r-- | jstests/slowNightly/explain1.js | 5 |
2 files changed, 14 insertions, 11 deletions
diff --git a/db/query.cpp b/db/query.cpp index 003ac6f3976..8734bec7fb0 100644 --- a/db/query.cpp +++ b/db/query.cpp @@ -435,14 +435,18 @@ namespace mongo { } virtual bool prepareToYield() { - if ( ! _cc ) { + if ( _c && !_cc ) { _cc.reset( new ClientCursor( QueryOption_NoCursorTimeout , _c , _ns.c_str() ) ); } - return _cc->prepareToYield( _yieldData ); + if ( _cc ) { + return _cc->prepareToYield( _yieldData ); + } + // no active cursor - ok to yield + return true; } virtual void recoverFromYield() { - if ( !ClientCursor::recoverFromYield( _yieldData ) ) { + if ( _cc && !ClientCursor::recoverFromYield( _yieldData ) ) { _c.reset(); _cc.reset(); @@ -698,11 +702,15 @@ namespace mongo { return _findingStartCursor->prepareToYield(); } else { - if ( ! _cc ) { + if ( _c && !_cc ) { _cc.reset( new ClientCursor( QueryOption_NoCursorTimeout , _c , _pq.ns() ) ); } - return _cc->prepareToYield( _yieldData ); + if ( _cc ) { + return _cc->prepareToYield( _yieldData ); + } } + // no active cursor - ok to yield + return true; } virtual void recoverFromYield() { @@ -711,7 +719,7 @@ namespace mongo { if ( _findingStartCursor.get() ) { _findingStartCursor->recoverFromYield(); } - else if ( ! ClientCursor::recoverFromYield( _yieldData ) ) { + else if ( _cc && !ClientCursor::recoverFromYield( _yieldData ) ) { _c.reset(); _cc.reset(); _so.reset(); diff --git a/jstests/slowNightly/explain1.js b/jstests/slowNightly/explain1.js index c5b3ed28a5d..81baeb6e918 100644 --- a/jstests/slowNightly/explain1.js +++ b/jstests/slowNightly/explain1.js @@ -1,8 +1,5 @@ // SERVER-2662 - drop client cursor in a context where query will yield frequently -// disabled until SERVER-2662 fixed -if ( false ) { - t = db.jstests_slowNightly_explain1; t.drop(); @@ -18,5 +15,3 @@ s3 = startParallelShell( "t = db.jstests_slowNightly_explain1; for( var i = 0; i s1(); s2(); s3(); - -}
\ No newline at end of file |