Skip to content

Commit

Permalink
SERVER-8442 don't release() direct m/r cursors to shards
Browse files Browse the repository at this point in the history
  • Loading branch information
gregs committed Feb 11, 2013
1 parent 974900c commit 4257f88
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/mongo/client/parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1564,12 +1564,21 @@ namespace mongo {
}

ParallelSortClusteredCursor::~ParallelSortClusteredCursor() {
// Clear out our metadata before removing legacy cursor data
_cursorMap.clear();
for( int i = 0; i < _numServers; i++ ) _cursors[i].release();

// WARNING: Commands (in particular M/R) connect via _oldInit() directly to shards
bool isDirectShardCursor = _cursorMap.empty();

// Non-direct shard cursors are owned by the _cursorMap, so we release
// them in the array here. Direct shard cursors clean themselves.
if (!isDirectShardCursor) {
for( int i = 0; i < _numServers; i++ ) _cursors[i].release();
}

delete [] _cursors;
_cursors = 0;

// Clear out our metadata after removing legacy cursor data
_cursorMap.clear();
}

bool ParallelSortClusteredCursor::more() {
Expand Down

0 comments on commit 4257f88

Please sign in to comment.