summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/oplogreader.cpp
diff options
context:
space:
mode:
authormatt dannenberg <matt.dannenberg@10gen.com>2015-07-13 09:27:56 -0400
committermatt dannenberg <matt.dannenberg@10gen.com>2015-07-16 11:17:36 -0400
commit785c4953e2330a5fc2366d20d3309c0ebd6a334a (patch)
tree70f9ee6a5484f9d82d9471e6911c42d53831de3f /src/mongo/db/repl/oplogreader.cpp
parentddffe2823221656e10844e7681c5bd766b74c21d (diff)
downloadmongo-785c4953e2330a5fc2366d20d3309c0ebd6a334a.tar.gz
SERVER-19375 choose new sync source based on last fetched op rather than last applied op
also change chooseNewSyncSource to take a Timestamp rather than an OpTime
Diffstat (limited to 'src/mongo/db/repl/oplogreader.cpp')
-rw-r--r--src/mongo/db/repl/oplogreader.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/db/repl/oplogreader.cpp b/src/mongo/db/repl/oplogreader.cpp
index 950517d6192..e363767ec05 100644
--- a/src/mongo/db/repl/oplogreader.cpp
+++ b/src/mongo/db/repl/oplogreader.cpp
@@ -147,7 +147,7 @@ void OplogReader::connectToSyncSource(OperationContext* txn,
invariant(conn() == NULL);
while (true) {
- HostAndPort candidate = replCoord->chooseNewSyncSource();
+ HostAndPort candidate = replCoord->chooseNewSyncSource(lastOpTimeFetched.getTimestamp());
if (candidate.empty()) {
if (oldestOpTimeSeen == sentinel) {
@@ -186,7 +186,8 @@ void OplogReader::connectToSyncSource(OperationContext* txn,
OpTime remoteOldOpTime = extractOpTime(remoteOldestOp);
// remoteOldOpTime may come from a very old config, so we cannot compare their terms.
- if (lastOpTimeFetched.getTimestamp() < remoteOldOpTime.getTimestamp()) {
+ if (!lastOpTimeFetched.isNull() &&
+ lastOpTimeFetched.getTimestamp() < remoteOldOpTime.getTimestamp()) {
// We're too stale to use this sync source.
resetConnection();
replCoord->blacklistSyncSource(candidate, Date_t::now() + Minutes(10));