diff options
author | Aaron <aaron@10gen.com> | 2012-02-20 12:49:39 -0800 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2012-02-24 22:49:14 -0800 |
commit | a08868df50fc2d53c05cd434dda2e9a82ec7dc5e (patch) | |
tree | e160113f4d9ab36ff7cec959deef56417db17a2c /src | |
parent | 7d9d6ac098d8deee0e99fc3d60828f9e73635eb9 (diff) | |
download | mongo-a08868df50fc2d53c05cd434dda2e9a82ec7dc5e.tar.gz |
SERVER-4150 set position of client cursor, to be returned by get more
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/ops/query.cpp | 8 | ||||
-rw-r--r-- | src/mongo/dbtests/querytests.cpp | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/mongo/db/ops/query.cpp b/src/mongo/db/ops/query.cpp index c8b8be8a897..d717145446e 100644 --- a/src/mongo/db/ops/query.cpp +++ b/src/mongo/db/ops/query.cpp @@ -1129,7 +1129,9 @@ namespace mongo { // at this point throw SendStaleConfigException( ns , "version changed during initial query" ); } - + + long long nReturned = queryResponseBuilder.handoff( result ); + ccPointer.reset(); long long cursorid = 0; if ( saveClientCursor ) { @@ -1154,12 +1156,12 @@ namespace mongo { exhaust = ns; curop.debug().exhaust = true; } + ccPointer->setPos( nReturned ); ccPointer->pq = pq_shared; ccPointer->fields = pq.getFieldPtr(); ccPointer.release(); } - long long nReturned = queryResponseBuilder.handoff( result ); QueryResult *qr = (QueryResult *) result.header(); qr->cursorId = cursorid; curop.debug().cursorid = ( cursorid == 0 ? -1 : qr->cursorId ); @@ -1401,7 +1403,7 @@ namespace mongo { cursorid = cc->cursorid(); DEV tlog(2) << "query has more, cursorid: " << cursorid << endl; - cc->setPos( n ); +// cc->setPos( n ); // cc->pq = pq_shared; // cc->fields = pq.getFieldPtr(); // cc->originalMessage = m; diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp index a6457ee44e5..ced33ca98ff 100644 --- a/src/mongo/dbtests/querytests.cpp +++ b/src/mongo/dbtests/querytests.cpp @@ -208,6 +208,7 @@ namespace QueryTests { ClientCursor::Pointer clientCursor( cursorId ); ASSERT( clientCursor.c()->pq ); ASSERT_EQUALS( 2, clientCursor.c()->pq->getNumToReturn() ); + ASSERT_EQUALS( 2, clientCursor.c()->pos() ); } cursor = client().getMore( ns, cursorId ); |