Skip to content

Commit

Permalink
SERVER-4150 set position of client cursor, to be returned by get more
Browse files Browse the repository at this point in the history
  • Loading branch information
astaple committed Feb 25, 2012
1 parent 7d9d6ac commit a08868d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/mongo/db/ops/query.cpp
Expand Up @@ -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 ) {
Expand All @@ -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 );
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/mongo/dbtests/querytests.cpp
Expand Up @@ -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 );
Expand Down

0 comments on commit a08868d

Please sign in to comment.