diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/ops/query.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mongo/db/ops/query.cpp b/src/mongo/db/ops/query.cpp index 9a1664f38d1..e503315fb2e 100644 --- a/src/mongo/db/ops/query.cpp +++ b/src/mongo/db/ops/query.cpp @@ -1200,6 +1200,7 @@ namespace mongo { for( ; cursor->ok(); cursor->advance() ) { bool yielded = false; if ( !ccPointer->yieldSometimes( ClientCursor::MaybeCovered, &yielded ) || !cursor->ok() ) { + cursor.reset(); queryResponseBuilder.noteYield(); break; } @@ -1246,6 +1247,15 @@ namespace mongo { } } + if ( cursor ) { + if ( pq.hasOption( QueryOption_CursorTailable ) && pq.getNumToReturn() != 1 ) + cursor->setTailable(); + + // If the tailing request succeeded. + if ( cursor->tailable() ) + cursorid = ccPointer->cursorid(); + } + if ( cursorid == 0 ) { ccPointer.reset(); } |