diff options
author | Eliot Horowitz <eliot@10gen.com> | 2012-08-21 18:28:40 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2012-08-21 18:28:59 -0400 |
commit | 089f96e956634cf922fd3dc99681d7f56318502a (patch) | |
tree | fecf9010d0b91c72cbbc27fcf82c8207f8e086ac | |
parent | 3f518bf76c1db505449bf8b14b8afd084736006e (diff) | |
download | mongo-089f96e956634cf922fd3dc99681d7f56318502a.tar.gz |
SERVER-6785 fix leaking parallel cursor on unsharded reads
-rw-r--r-- | src/mongo/s/strategy_shard.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/s/strategy_shard.cpp b/src/mongo/s/strategy_shard.cpp index 2e5ecd1da45..e0acb4a0455 100644 --- a/src/mongo/s/strategy_shard.cpp +++ b/src/mongo/s/strategy_shard.cpp @@ -125,11 +125,20 @@ namespace mongo { startFrom, hasMore ? cc->getId() : 0 ); } else{ + // Remote cursors are stored remotely, we shouldn't need this around. + // TODO: we should probably just make cursor an auto_ptr + scoped_ptr<ParallelSortClusteredCursor> cursorDeleter( cursor ); + // TODO: Better merge this logic. We potentially can now use the same cursor logic for everything. ShardPtr primary = cursor->getPrimary(); verify( primary.get() ); DBClientCursorPtr shardCursor = cursor->getShardCursor( *primary ); + + // Implicitly stores the cursor in the cache r.reply( *(shardCursor->getMessage()) , shardCursor->originalHost() ); + + // We don't want to kill the cursor remotely if there's still data left + shardCursor->decouple(); } } |