diff options
author | Aaron <aaron@10gen.com> | 2011-03-17 11:51:26 -0700 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-03-18 22:04:52 -0400 |
commit | 15c6cce90ad277ecb10cc9f4f8a53f4061358259 (patch) | |
tree | 15c860810a6fbb68241b92ea99975c98eaf1f327 /db | |
parent | ab41f59e8f8d5bd9f40513cd1121f4365d3484c4 (diff) | |
download | mongo-15c6cce90ad277ecb10cc9f4f8a53f4061358259.tar.gz |
SERVER-2662 don't attempt to yield a query after an earlier yield fails and drops the cursor
Diffstat (limited to 'db')
-rw-r--r-- | db/query.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/db/query.cpp b/db/query.cpp index df09fcec51c..50e2fc385fa 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(); |