diff options
author | Aaron <aaron@10gen.com> | 2012-02-17 23:19:02 -0800 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2012-02-24 22:49:10 -0800 |
commit | 17d6036719d3b95f2dfa06f71dd6c658926e3265 (patch) | |
tree | 28a8ec0cf87de95e117c4b0b53b11a8ef1d43dd8 /src | |
parent | 7cd174a71c58f150038987d2f492de92cc952fc7 (diff) | |
download | mongo-17d6036719d3b95f2dfa06f71dd6c658926e3265.tar.gz |
SERVER-4150 add support for tailable cursors (tests already in querytests.cpp)
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(); } |