summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/sync_source_resolver.cpp
diff options
context:
space:
mode:
authorXueruiFa <xuerui.fa@mongodb.com>2020-06-22 18:31:41 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-01 16:09:42 +0000
commit5ffbd8f8322651b4953f29da0cde9e31eab039d4 (patch)
treeb81486a2abdcf60825b1b9427d964499c366d94b /src/mongo/db/repl/sync_source_resolver.cpp
parente4f92ef12f233e86be9de019f16db4f5dde47ad5 (diff)
downloadmongo-5ffbd8f8322651b4953f29da0cde9e31eab039d4.tar.gz
SERVER-47270: Only run the SyncSourceResolver if the syncing node is in rollback-via-refetch
Diffstat (limited to 'src/mongo/db/repl/sync_source_resolver.cpp')
-rw-r--r--src/mongo/db/repl/sync_source_resolver.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/mongo/db/repl/sync_source_resolver.cpp b/src/mongo/db/repl/sync_source_resolver.cpp
index 4b4a9a178a2..ba7f06c24ea 100644
--- a/src/mongo/db/repl/sync_source_resolver.cpp
+++ b/src/mongo/db/repl/sync_source_resolver.cpp
@@ -37,7 +37,6 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/repl/oplog_entry.h"
-#include "mongo/db/repl/replication_process.h"
#include "mongo/db/repl/sync_source_selector.h"
#include "mongo/logv2/log.h"
#include "mongo/rpc/get_status_from_command_result.h"
@@ -372,6 +371,13 @@ void SyncSourceResolver::_firstOplogEntryFetcherCallback(
return;
}
+ // If we should not proceed with the rollback-via-refetch checks, we can safely return the
+ // candidate with an uninitialized rbid.
+ if (_requiredOpTime.isNull()) {
+ _finishCallback(candidate, ReplicationProcess::kUninitializedRollbackId).ignore();
+ return;
+ }
+
auto status = _scheduleRBIDRequest(candidate, earliestOpTimeSeen);
if (!status.isOK()) {
_finishCallback(status).ignore();
@@ -434,18 +440,12 @@ void SyncSourceResolver::_rbidRequestCallback(
return;
}
- if (!_requiredOpTime.isNull()) {
- // Schedule fetcher to look for '_requiredOpTime' in the remote oplog.
- // Unittest requires that this kind of failure be handled specially.
- auto status =
- _scheduleFetcher(_makeRequiredOpTimeFetcher(candidate, earliestOpTimeSeen, rbid));
- if (!status.isOK()) {
- _finishCallback(status).transitional_ignore();
- }
- return;
+ // Schedule fetcher to look for '_requiredOpTime' in the remote oplog.
+ // Unittest requires that this kind of failure be handled specially.
+ auto status = _scheduleFetcher(_makeRequiredOpTimeFetcher(candidate, earliestOpTimeSeen, rbid));
+ if (!status.isOK()) {
+ _finishCallback(status).ignore();
}
-
- _finishCallback(candidate, rbid).ignore();
}
Status SyncSourceResolver::_compareRequiredOpTimeWithQueryResponse(
@@ -570,9 +570,7 @@ Status SyncSourceResolver::_chooseAndProbeNextSyncSource(OpTime earliestOpTimeSe
Status SyncSourceResolver::_finishCallback(HostAndPort hostAndPort, int rbid) {
SyncSourceResolverResponse response;
response.syncSourceStatus = std::move(hostAndPort);
- if (rbid != ReplicationProcess::kUninitializedRollbackId) {
- response.rbid = rbid;
- }
+ response.rbid = rbid;
return _finishCallback(response);
}