summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Hernandez <scotthernandez@gmail.com>2016-01-29 13:53:26 -0500
committerScott Hernandez <scotthernandez@gmail.com>2016-01-29 14:00:50 -0500
commit8f4c9f4f690407f5676da8c7089a7512a1d4d014 (patch)
tree46bf525eb9a160682315ee402d4e619ec4e3c55c
parentd04d195125a020c2eb75a884daa1cb190db08fb7 (diff)
downloadmongo-8f4c9f4f690407f5676da8c7089a7512a1d4d014.tar.gz
SERVER-22335: only prepare getmore when needed in bgsync fetcher
(cherry picked from commit 1175510702d070e4eeed436d81c52dec855f664e)
-rw-r--r--src/mongo/db/repl/bgsync.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp
index 41b58658162..25c39e8c640 100644
--- a/src/mongo/db/repl/bgsync.cpp
+++ b/src/mongo/db/repl/bgsync.cpp
@@ -635,14 +635,15 @@ void BackgroundSync::_fetcherCallback(const StatusWith<Fetcher::QueryResponse>&
return;
}
- // We fill in 'bob' to signal the fetcher to process with another getMore.
- invariant(bob);
- bob->append("getMore", queryResponse.cursorId);
- bob->append("collection", queryResponse.nss.coll());
- bob->append("maxTimeMS", durationCount<Milliseconds>(fetcherMaxTimeMS));
- if (receivedMetadata) {
- bob->append("term", _replCoord->getTerm());
- _replCoord->getLastCommittedOpTime().append(bob, "lastKnownCommittedOpTime");
+ // We fill in 'bob' to signal the fetcher to process with another getMore, if needed.
+ if (bob) {
+ bob->append("getMore", queryResponse.cursorId);
+ bob->append("collection", queryResponse.nss.coll());
+ bob->append("maxTimeMS", durationCount<Milliseconds>(fetcherMaxTimeMS));
+ if (receivedMetadata) {
+ bob->append("term", _replCoord->getTerm());
+ _replCoord->getLastCommittedOpTime().append(bob, "lastKnownCommittedOpTime");
+ }
}
}