diff options
author | Jason Rassi <rassi@10gen.com> | 2015-08-29 09:59:30 -0400 |
---|---|---|
committer | Jason Rassi <rassi@10gen.com> | 2015-08-29 09:59:30 -0400 |
commit | 2a77a9c7cdf4ba069897286d88e379e1873bb6f8 (patch) | |
tree | 3b27a388c89025341e9fbdad6fb843fab004f25b /src/mongo/s/query/async_results_merger.cpp | |
parent | e44050e265bbea2d3c9bb2194a5773ffa6657f22 (diff) | |
download | mongo-2a77a9c7cdf4ba069897286d88e379e1873bb6f8.tar.gz |
Revert "Revert "SERVER-19569 AsyncResultsMerger ability to merge existing cursors""
This reverts commit e44050e265bbea2d3c9bb2194a5773ffa6657f22.
Diffstat (limited to 'src/mongo/s/query/async_results_merger.cpp')
-rw-r--r-- | src/mongo/s/query/async_results_merger.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/mongo/s/query/async_results_merger.cpp b/src/mongo/s/query/async_results_merger.cpp index 5a1992cc280..9ad91a611ab 100644 --- a/src/mongo/s/query/async_results_merger.cpp +++ b/src/mongo/s/query/async_results_merger.cpp @@ -91,7 +91,7 @@ bool AsyncResultsMerger::ready_inlock() { // We don't return any results until we have received at least one response from each remote // node. This is necessary for versioned commands: we have to ensure that we've properly // established the shard version on each node before we can start returning results. - if (!remote.gotFirstResponse) { + if (!remote.cursorId) { return false; } } @@ -224,7 +224,7 @@ Status AsyncResultsMerger::askForNextBatch_inlock(size_t remoteIndex) { BSONObj cmdObj = remote.cursorId ? GetMoreRequest(_params.nsString, *remote.cursorId, adjustedBatchSize, boost::none) .toBSON() - : remote.cmdObj; + : *remote.cmdObj; executor::RemoteCommandRequest request( remote.hostAndPort, _params.nsString.db().toString(), cmdObj); @@ -351,10 +351,8 @@ void AsyncResultsMerger::handleBatchResponse( return; } - // Mark that we've gotten a valid response back from 'remote' at least once. - remote.gotFirstResponse = true; - remote.cursorId = cursorResponse.cursorId; + remote.cmdObj = boost::none; for (const auto& obj : cursorResponse.batch) { remote.docBuffer.push(obj); @@ -483,7 +481,10 @@ executor::TaskExecutor::EventHandle AsyncResultsMerger::kill() { AsyncResultsMerger::RemoteCursorData::RemoteCursorData( const ClusterClientCursorParams::Remote& params) - : hostAndPort(params.hostAndPort), cmdObj(params.cmdObj) {} + : hostAndPort(params.hostAndPort), cmdObj(params.cmdObj), cursorId(params.cursorId) { + // Either cmdObj or cursorId can be provided, but not both. + invariant(static_cast<bool>(cmdObj) != static_cast<bool>(cursorId)); +} bool AsyncResultsMerger::RemoteCursorData::hasNext() const { return !docBuffer.empty(); |