Skip to content

Commit

Permalink
SERVER-4150 store chunk manager in client cursor to hand off to get more
Browse files Browse the repository at this point in the history
  • Loading branch information
astaple committed Feb 25, 2012
1 parent a08868d commit febc2c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/mongo/db/ops/query.cpp
Expand Up @@ -1138,6 +1138,7 @@ namespace mongo {
ccPointer.reset( new ClientCursor( queryOptions, cursor, ns,
jsobj.getOwned() ) );
cursorid = ccPointer->cursorid();
DEV tlog(2) << "query has more, cursorid: " << cursorid << endl;
if ( cursor->supportYields() ) {
ClientCursor::YieldData data;
ccPointer->prepareToYield( data );
Expand All @@ -1156,6 +1157,7 @@ namespace mongo {
exhaust = ns;
curop.debug().exhaust = true;
}
ccPointer->setChunkManager( queryResponseBuilder.chunkManager() );
ccPointer->setPos( nReturned );
ccPointer->pq = pq_shared;
ccPointer->fields = pq.getFieldPtr();
Expand Down Expand Up @@ -1384,10 +1386,10 @@ namespace mongo {
shared_ptr<Cursor> cursor = dqo.cursor();
if( logLevel >= 5 )
log() << " used cursor: " << cursor.get() << endl;
long long cursorid = 0;
// long long cursorid = 0;
// const char * exhaust = 0;
if ( dqo.saveClientCursor() || ( dqo.wouldSaveClientCursor() && mps->mayRunMore() ) ) {
ClientCursor *cc;
// ClientCursor *cc;
// bool moreClauses = mps->mayRunMore();
// if ( moreClauses ) {
// // this MultiCursor will use a dumb NoOp to advance(), so no need to specify mayYield
Expand All @@ -1398,11 +1400,11 @@ namespace mongo {
// if( ! cursor->matcher() ) cursor->setMatcher( dqo.matcher( cursor ) );
// cc = new ClientCursor( queryOptions, cursor, ns, jsobj.getOwned() );
// }

cc->setChunkManager( dqo.getChunkManager() );

cursorid = cc->cursorid();
DEV tlog(2) << "query has more, cursorid: " << cursorid << endl;
//
// cc->setChunkManager( dqo.getChunkManager() );
//
// cursorid = cc->cursorid();
// DEV tlog(2) << "query has more, cursorid: " << cursorid << endl;
// cc->setPos( n );
// cc->pq = pq_shared;
// cc->fields = pq.getFieldPtr();
Expand Down
1 change: 1 addition & 0 deletions src/mongo/db/ops/query.h
Expand Up @@ -156,6 +156,7 @@ namespace mongo {
bool enoughTotalResults() const;
void finishedFirstBatch();
long long handoff( Message &result );
ShardChunkManagerPtr chunkManager() const { return _chunkManager; }
private:
ShardChunkManagerPtr newChunkManager() const;
shared_ptr<ExplainRecordingStrategy> newExplainRecordingStrategy
Expand Down

0 comments on commit febc2c8

Please sign in to comment.