diff options
author | William Schultz <william.schultz@mongodb.com> | 2018-07-06 10:41:17 -0400 |
---|---|---|
committer | William Schultz <william.schultz@mongodb.com> | 2018-07-06 10:41:17 -0400 |
commit | 2c6614c3bd716fb9ccaad1f7c68e9eb490ed1df6 (patch) | |
tree | 2884f7ee71a5ae223f8523b135aca727ecdcb863 /src | |
parent | 4c385bcfb46d16cc054131722dfe3e9f7c09eb0d (diff) | |
download | mongo-2c6614c3bd716fb9ccaad1f7c68e9eb490ed1df6.tar.gz |
SERVER-35200 Speed up steady state oplog fetching failure detection
This patch attempts to improve how quickly a secondary node in
steady state replication detects that its current sync source has failed
or become partitioned and tries to select a new sync souce. The speed of
this process can significantly impact how long it takes for a new
primary to begin committing majority writes after a previous primary
has failed or become partitioned from the replica set. This patch
improves on the old behavior by reducing the number of fetcher restarts
to 1, and also reducing the oplog 'find' request timeout used on a restart.
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/repl/abstract_oplog_fetcher.cpp | 37 | ||||
-rw-r--r-- | src/mongo/db/repl/abstract_oplog_fetcher.h | 16 | ||||
-rw-r--r-- | src/mongo/db/repl/abstract_oplog_fetcher_test.cpp | 124 | ||||
-rw-r--r-- | src/mongo/db/repl/bgsync.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog_fetcher.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog_fetcher.h | 3 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_external_state.h | 10 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_external_state_impl.cpp | 30 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_external_state_impl.h | 3 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_external_state_mock.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_external_state_mock.h | 3 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl.cpp | 3 |
12 files changed, 213 insertions, 31 deletions
diff --git a/src/mongo/db/repl/abstract_oplog_fetcher.cpp b/src/mongo/db/repl/abstract_oplog_fetcher.cpp index 2078c122c23..ce18d5c7a69 100644 --- a/src/mongo/db/repl/abstract_oplog_fetcher.cpp +++ b/src/mongo/db/repl/abstract_oplog_fetcher.cpp @@ -52,8 +52,15 @@ ServerStatusMetricField<Counter64> displayReadersCreated("repl.network.readersCr &readersCreatedStats); // Number of seconds for the `maxTimeMS` on the initial `find` command. +// +// For the initial 'find' request, we provide a generous timeout, to account for the potentially +// slow process of a sync source finding the lastApplied optime provided in a node's query in its +// oplog. MONGO_EXPORT_SERVER_PARAMETER(oplogInitialFindMaxSeconds, int, 60); +// Number of seconds for the `maxTimeMS` on any retried `find` commands. +MONGO_EXPORT_SERVER_PARAMETER(oplogRetriedFindMaxSeconds, int, 2); + // Number of milliseconds to add to the `find` and `getMore` timeouts to calculate the network // timeout for the requests. const Milliseconds kNetworkTimeoutBufferMS{5000}; @@ -97,10 +104,14 @@ AbstractOplogFetcher::AbstractOplogFetcher(executor::TaskExecutor* executor, invariant(onShutdownCallbackFn); } -Milliseconds AbstractOplogFetcher::_getFindMaxTime() const { +Milliseconds AbstractOplogFetcher::_getInitialFindMaxTime() const { return Milliseconds(oplogInitialFindMaxSeconds.load() * 1000); } +Milliseconds AbstractOplogFetcher::_getRetriedFindMaxTime() const { + return Milliseconds(oplogRetriedFindMaxSeconds.load() * 1000); +} + Milliseconds AbstractOplogFetcher::_getGetMoreMaxTime() const { return kDefaultOplogGetMoreMaxMS; } @@ -126,13 +137,14 @@ void AbstractOplogFetcher::_makeAndScheduleFetcherCallback( return; } - BSONObj findCommandObj = _makeFindCommandObject(_nss, _getLastOpTimeWithHashFetched().opTime); + BSONObj findCommandObj = _makeFindCommandObject( + _nss, _getLastOpTimeWithHashFetched().opTime, _getInitialFindMaxTime()); BSONObj metadataObj = _makeMetadataObject(); Status scheduleStatus = Status::OK(); { stdx::lock_guard<stdx::mutex> lock(_mutex); - _fetcher = _makeFetcher(findCommandObj, metadataObj); + _fetcher = _makeFetcher(findCommandObj, metadataObj, _getInitialFindMaxTime()); scheduleStatus = _scheduleFetcher_inlock(); } if (!scheduleStatus.isOK()) { @@ -181,7 +193,8 @@ BSONObj AbstractOplogFetcher::getCommandObject_forTest() const { } BSONObj AbstractOplogFetcher::getFindQuery_forTest() const { - return _makeFindCommandObject(_nss, _getLastOpTimeWithHashFetched().opTime); + return _makeFindCommandObject( + _nss, _getLastOpTimeWithHashFetched().opTime, _getInitialFindMaxTime()); } HostAndPort AbstractOplogFetcher::_getSource() const { @@ -206,8 +219,9 @@ void AbstractOplogFetcher::_callback(const Fetcher::QueryResponseStatus& result, // If target cut connections between connecting and querying (for // example, because it stepped down) we might not have a cursor. if (!responseStatus.isOK()) { - BSONObj findCommandObj = - _makeFindCommandObject(_nss, _getLastOpTimeWithHashFetched().opTime); + + BSONObj findCommandObj = _makeFindCommandObject( + _nss, _getLastOpTimeWithHashFetched().opTime, _getRetriedFindMaxTime()); BSONObj metadataObj = _makeMetadataObject(); { stdx::lock_guard<stdx::mutex> lock(_mutex); @@ -223,8 +237,10 @@ void AbstractOplogFetcher::_callback(const Fetcher::QueryResponseStatus& result, _shuttingDownFetcher.reset(); // Move the old fetcher into the shutting down instance. _shuttingDownFetcher.swap(_fetcher); - // Create and start fetcher with current term and new starting optime. - _fetcher = _makeFetcher(findCommandObj, metadataObj); + // Create and start fetcher with current term and new starting optime, and use the + // retry 'find' timeout. + _fetcher = _makeFetcher(findCommandObj, metadataObj, _getRetriedFindMaxTime()); + auto scheduleStatus = _scheduleFetcher_inlock(); if (scheduleStatus.isOK()) { log() << "Scheduled new oplog query " << _fetcher->toString(); @@ -318,7 +334,8 @@ void AbstractOplogFetcher::_finishCallback(Status status) { } std::unique_ptr<Fetcher> AbstractOplogFetcher::_makeFetcher(const BSONObj& findCommandObj, - const BSONObj& metadataObj) { + const BSONObj& metadataObj, + Milliseconds findMaxTime) { return stdx::make_unique<Fetcher>( _getExecutor(), _source, @@ -328,7 +345,7 @@ std::unique_ptr<Fetcher> AbstractOplogFetcher::_makeFetcher(const BSONObj& findC Fetcher::NextAction*, BSONObjBuilder* builder) { return _callback(resp, builder); }, metadataObj, - _getFindMaxTime() + kNetworkTimeoutBufferMS, + findMaxTime + kNetworkTimeoutBufferMS, _getGetMoreMaxTime() + kNetworkTimeoutBufferMS); } diff --git a/src/mongo/db/repl/abstract_oplog_fetcher.h b/src/mongo/db/repl/abstract_oplog_fetcher.h index 087e1c4ac42..778c09899d9 100644 --- a/src/mongo/db/repl/abstract_oplog_fetcher.h +++ b/src/mongo/db/repl/abstract_oplog_fetcher.h @@ -113,7 +113,15 @@ protected: /** * Returns how long the `find` command should wait before timing out. */ - virtual Milliseconds _getFindMaxTime() const; + virtual Milliseconds _getInitialFindMaxTime() const; + + /** + * Returns how long the `find` command should wait before timing out, if we are retrying the + * 'find' due to an error. This timeout should be considerably smaller than our initial oplog + * find time, since a communication failure with an upstream node may indicate it is + * unreachable. + */ + virtual Milliseconds _getRetriedFindMaxTime() const; /** * Returns how long the `getMore` command should wait before timing out. @@ -156,7 +164,8 @@ private: * it can begin its Fetcher from the middle of the oplog. */ virtual BSONObj _makeFindCommandObject(const NamespaceString& nss, - OpTime lastOpTimeFetched) const = 0; + OpTime lastOpTimeFetched, + Milliseconds findMaxTime) const = 0; /** * This function must be overriden by subclass oplog fetchers to specify what metadata object @@ -177,7 +186,8 @@ private: * This function creates a Fetcher with the given `find` command and metadata. */ std::unique_ptr<Fetcher> _makeFetcher(const BSONObj& findCommandObj, - const BSONObj& metadataObj); + const BSONObj& metadataObj, + Milliseconds findTimeout); /** * Callback used to make a Fetcher, and then save and schedule it in a lock. */ diff --git a/src/mongo/db/repl/abstract_oplog_fetcher_test.cpp b/src/mongo/db/repl/abstract_oplog_fetcher_test.cpp index 067928e6bb2..388e1492461 100644 --- a/src/mongo/db/repl/abstract_oplog_fetcher_test.cpp +++ b/src/mongo/db/repl/abstract_oplog_fetcher_test.cpp @@ -49,6 +49,9 @@ using NetworkGuard = executor::NetworkInterfaceMock::InNetworkGuard; HostAndPort source("localhost:12345"); NamespaceString nss("local.oplog.rs"); +// For testing. Should match the value used in the AbstractOplogFetcher. +const Milliseconds kNetworkTimeoutBufferMS{5000}; + /** * This class is the minimal implementation of an oplog fetcher. It has the simplest `find` command * possible, no metadata, and the _onSuccessfulBatch function simply returns a `getMore` command @@ -63,12 +66,28 @@ public: std::size_t maxFetcherRestarts, OnShutdownCallbackFn onShutdownCallbackFn); + void setInitialFindMaxTime(Milliseconds findMaxTime) { + _initialFindMaxTime = findMaxTime; + } + + void setRetriedFindMaxTime(Milliseconds findMaxTime) { + _retriedFindMaxTime = findMaxTime; + } + private: BSONObj _makeFindCommandObject(const NamespaceString& nss, - OpTime lastOpTimeFetched) const override; + OpTime lastOpTimeFetched, + Milliseconds findMaxTime) const override; BSONObj _makeMetadataObject() const override; StatusWith<BSONObj> _onSuccessfulBatch(const Fetcher::QueryResponse& queryResponse) override; + + Milliseconds _getInitialFindMaxTime() const override; + + Milliseconds _getRetriedFindMaxTime() const override; + + Milliseconds _initialFindMaxTime{60000}; + Milliseconds _retriedFindMaxTime{2000}; }; MockOplogFetcher::MockOplogFetcher(executor::TaskExecutor* executor, @@ -85,11 +104,21 @@ MockOplogFetcher::MockOplogFetcher(executor::TaskExecutor* executor, onShutdownCallbackFn, "mock oplog fetcher") {} +Milliseconds MockOplogFetcher::_getInitialFindMaxTime() const { + return _initialFindMaxTime; +} + +Milliseconds MockOplogFetcher::_getRetriedFindMaxTime() const { + return _retriedFindMaxTime; +} + BSONObj MockOplogFetcher::_makeFindCommandObject(const NamespaceString& nss, - OpTime lastOpTimeFetched) const { + OpTime lastOpTimeFetched, + Milliseconds findMaxTime) const { BSONObjBuilder cmdBob; cmdBob.append("find", nss.coll()); cmdBob.append("filter", BSON("ts" << BSON("$gte" << lastOpTimeFetched.getTimestamp()))); + cmdBob.append("maxTimeMS", durationCount<Milliseconds>(findMaxTime)); return cmdBob.obj(); } @@ -396,6 +425,97 @@ TEST_F(AbstractOplogFetcherTest, ASSERT_EQUALS(ErrorCodes::CappedPositionLost, shutdownState->getStatus()); } +TEST_F(AbstractOplogFetcherTest, OplogFetcherTimesOutCorrectlyOnInitialFindRequests) { + auto ops = _generateOplogEntries(2U); + std::size_t maxFetcherRestarts = 0U; + auto shutdownState = stdx::make_unique<ShutdownState>(); + MockOplogFetcher oplogFetcher(&getExecutor(), + _getOpTimeWithHash(ops[0]), + source, + nss, + maxFetcherRestarts, + stdx::ref(*shutdownState)); + + // Set a finite network timeout for the initial find request. + auto initialFindMaxTime = Milliseconds(10000); + oplogFetcher.setInitialFindMaxTime(initialFindMaxTime); + + ON_BLOCK_EXIT([this] { getExecutor().shutdown(); }); + + ASSERT_OK(oplogFetcher.startup()); + ASSERT_TRUE(oplogFetcher.isActive()); + + auto net = getNet(); + + // Schedule a response at a time that would exceed the initial find request network timeout. + net->enterNetwork(); + auto when = net->now() + initialFindMaxTime + kNetworkTimeoutBufferMS + Milliseconds(10); + auto noi = getNet()->getNextReadyRequest(); + RemoteCommandResponse response = { + {makeCursorResponse(1, {ops[0], ops[1]})}, rpc::makeEmptyMetadata(), Milliseconds(0)}; + auto request = net->scheduleSuccessfulResponse(noi, when, response); + net->runUntil(when); + net->runReadyNetworkOperations(); + net->exitNetwork(); + + oplogFetcher.join(); + + // The fetcher should have shut down after its last request timed out. + ASSERT_EQUALS(ErrorCodes::NetworkTimeout, shutdownState->getStatus()); +} + +TEST_F(AbstractOplogFetcherTest, OplogFetcherTimesOutCorrectlyOnRetriedFindRequests) { + auto ops = _generateOplogEntries(2U); + std::size_t maxFetcherRestarts = 1U; + auto shutdownState = stdx::make_unique<ShutdownState>(); + MockOplogFetcher oplogFetcher(&getExecutor(), + _getOpTimeWithHash(ops[0]), + source, + nss, + maxFetcherRestarts, + stdx::ref(*shutdownState)); + + // Set finite network timeouts for the initial and retried find requests. + auto initialFindMaxTime = Milliseconds(10000); + auto retriedFindMaxTime = Milliseconds(1000); + oplogFetcher.setInitialFindMaxTime(initialFindMaxTime); + oplogFetcher.setRetriedFindMaxTime(retriedFindMaxTime); + + ON_BLOCK_EXIT([this] { getExecutor().shutdown(); }); + + ASSERT_OK(oplogFetcher.startup()); + ASSERT_TRUE(oplogFetcher.isActive()); + + auto net = getNet(); + + // Schedule a response at a time that would exceed the initial find request network timeout. + net->enterNetwork(); + auto when = net->now() + initialFindMaxTime + kNetworkTimeoutBufferMS + Milliseconds(10); + auto noi = getNet()->getNextReadyRequest(); + RemoteCommandResponse response = { + {makeCursorResponse(1, {ops[0], ops[1]})}, rpc::makeEmptyMetadata(), Milliseconds(0)}; + auto request = net->scheduleSuccessfulResponse(noi, when, response); + net->runUntil(when); + net->runReadyNetworkOperations(); + net->exitNetwork(); + + // Schedule a response at a time that would exceed the retried find request network timeout. + net->enterNetwork(); + when = net->now() + retriedFindMaxTime + kNetworkTimeoutBufferMS + Milliseconds(10); + noi = getNet()->getNextReadyRequest(); + response = { + {makeCursorResponse(1, {ops[0], ops[1]})}, rpc::makeEmptyMetadata(), Milliseconds(0)}; + request = net->scheduleSuccessfulResponse(noi, when, response); + net->runUntil(when); + net->runReadyNetworkOperations(); + net->exitNetwork(); + + oplogFetcher.join(); + + // The fetcher should have shut down after its last request timed out. + ASSERT_EQUALS(ErrorCodes::NetworkTimeout, shutdownState->getStatus()); +} + bool sharedCallbackStateDestroyed = false; class SharedCallbackState { MONGO_DISALLOW_COPYING(SharedCallbackState); diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp index 63bfc13e280..216fb122553 100644 --- a/src/mongo/db/repl/bgsync.cpp +++ b/src/mongo/db/repl/bgsync.cpp @@ -435,7 +435,7 @@ void BackgroundSync::_produce() { source, NamespaceString::kRsOplogNamespace, _replCoord->getConfig(), - _replicationCoordinatorExternalState->getOplogFetcherMaxFetcherRestarts(), + _replicationCoordinatorExternalState->getOplogFetcherSteadyStateMaxFetcherRestarts(), syncSourceResp.rbid, true /* requireFresherSyncSource */, &dataReplicatorExternalState, diff --git a/src/mongo/db/repl/oplog_fetcher.cpp b/src/mongo/db/repl/oplog_fetcher.cpp index 31c0eef2ff1..28af2d5a834 100644 --- a/src/mongo/db/repl/oplog_fetcher.cpp +++ b/src/mongo/db/repl/oplog_fetcher.cpp @@ -350,7 +350,8 @@ OplogFetcher::~OplogFetcher() { } BSONObj OplogFetcher::_makeFindCommandObject(const NamespaceString& nss, - OpTime lastOpTimeFetched) const { + OpTime lastOpTimeFetched, + Milliseconds findMaxTime) const { auto lastCommittedWithCurrentTerm = _dataReplicatorExternalState->getCurrentTermAndLastCommittedOpTime(); auto term = lastCommittedWithCurrentTerm.value; @@ -360,7 +361,7 @@ BSONObj OplogFetcher::_makeFindCommandObject(const NamespaceString& nss, cmdBob.append("tailable", true); cmdBob.append("oplogReplay", true); cmdBob.append("awaitData", true); - cmdBob.append("maxTimeMS", durationCount<Milliseconds>(_getFindMaxTime())); + cmdBob.append("maxTimeMS", durationCount<Milliseconds>(findMaxTime)); cmdBob.append("batchSize", _batchSize); if (term != OpTime::kUninitializedTerm) { diff --git a/src/mongo/db/repl/oplog_fetcher.h b/src/mongo/db/repl/oplog_fetcher.h index 8aab9ce6a53..bdd1ca9d2a7 100644 --- a/src/mongo/db/repl/oplog_fetcher.h +++ b/src/mongo/db/repl/oplog_fetcher.h @@ -146,7 +146,8 @@ public: private: BSONObj _makeFindCommandObject(const NamespaceString& nss, - OpTime lastOpTimeFetched) const override; + OpTime lastOpTimeFetched, + Milliseconds findMaxTime) const override; BSONObj _makeMetadataObject() const override; diff --git a/src/mongo/db/repl/replication_coordinator_external_state.h b/src/mongo/db/repl/replication_coordinator_external_state.h index a7a2c3637be..c9c6d4192b4 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state.h +++ b/src/mongo/db/repl/replication_coordinator_external_state.h @@ -287,9 +287,15 @@ public: /** * Returns maximum number of times that the oplog fetcher will consecutively restart the oplog - * tailing query on non-cancellation errors. + * tailing query on non-cancellation errors during steady state replication. */ - virtual std::size_t getOplogFetcherMaxFetcherRestarts() const = 0; + virtual std::size_t getOplogFetcherSteadyStateMaxFetcherRestarts() const = 0; + + /** + * Returns maximum number of times that the oplog fetcher will consecutively restart the oplog + * tailing query on non-cancellation errors during initial sync. + */ + virtual std::size_t getOplogFetcherInitialSyncMaxFetcherRestarts() const = 0; /* * Creates noop writer instance. Setting the _noopWriter member is not protected by a guard, diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp index dfd54fb93f3..809cb5140b5 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp @@ -123,13 +123,25 @@ const char tsFieldName[] = "ts"; MONGO_FAIL_POINT_DEFINE(dropPendingCollectionReaperHang); -// Set this to specify maximum number of times the oplog fetcher will consecutively restart the -// oplog tailing query on non-cancellation errors. -MONGO_EXPORT_SERVER_PARAMETER(oplogFetcherMaxFetcherRestarts, int, 3) +// Set this to specify the maximum number of times the oplog fetcher will consecutively restart the +// oplog tailing query on non-cancellation errors during steady state replication. +MONGO_EXPORT_SERVER_PARAMETER(oplogFetcherSteadyStateMaxFetcherRestarts, int, 1) ->withValidator([](const int& potentialNewValue) { if (potentialNewValue < 0) { return Status(ErrorCodes::BadValue, - "oplogFetcherMaxFetcherRestarts must be nonnegative"); + "oplogFetcherSteadyStateMaxFetcherRestarts must be nonnegative"); + } + return Status::OK(); + }); + +// Set this to specify the maximum number of times the oplog fetcher will consecutively restart the +// oplog tailing query on non-cancellation errors during initial sync. By default we provide a +// generous amount of restarts to avoid potentially restarting an entire initial sync from scratch. +MONGO_EXPORT_SERVER_PARAMETER(oplogFetcherInitialSyncMaxFetcherRestarts, int, 10) + ->withValidator([](const int& potentialNewValue) { + if (potentialNewValue < 0) { + return Status(ErrorCodes::BadValue, + "oplogFetcherInitialSyncMaxFetcherRestarts must be nonnegative"); } return Status::OK(); }); @@ -926,8 +938,14 @@ bool ReplicationCoordinatorExternalStateImpl::isReadConcernSnapshotSupportedBySt return storageEngine->supportsReadConcernSnapshot(); } -std::size_t ReplicationCoordinatorExternalStateImpl::getOplogFetcherMaxFetcherRestarts() const { - return oplogFetcherMaxFetcherRestarts.load(); +std::size_t ReplicationCoordinatorExternalStateImpl::getOplogFetcherSteadyStateMaxFetcherRestarts() + const { + return oplogFetcherSteadyStateMaxFetcherRestarts.load(); +} + +std::size_t ReplicationCoordinatorExternalStateImpl::getOplogFetcherInitialSyncMaxFetcherRestarts() + const { + return oplogFetcherInitialSyncMaxFetcherRestarts.load(); } JournalListener::Token ReplicationCoordinatorExternalStateImpl::getToken() { diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.h b/src/mongo/db/repl/replication_coordinator_external_state_impl.h index 98f209e3135..8607be1af20 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_impl.h +++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.h @@ -105,7 +105,8 @@ public: virtual double getElectionTimeoutOffsetLimitFraction() const; virtual bool isReadCommittedSupportedByStorageEngine(OperationContext* opCtx) const; virtual bool isReadConcernSnapshotSupportedByStorageEngine(OperationContext* opCtx) const; - virtual std::size_t getOplogFetcherMaxFetcherRestarts() const override; + virtual std::size_t getOplogFetcherSteadyStateMaxFetcherRestarts() const override; + virtual std::size_t getOplogFetcherInitialSyncMaxFetcherRestarts() const override; // Methods from JournalListener. virtual JournalListener::Token getToken(); diff --git a/src/mongo/db/repl/replication_coordinator_external_state_mock.cpp b/src/mongo/db/repl/replication_coordinator_external_state_mock.cpp index 23280156d26..5a4ab25d6e4 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_mock.cpp +++ b/src/mongo/db/repl/replication_coordinator_external_state_mock.cpp @@ -250,7 +250,13 @@ bool ReplicationCoordinatorExternalStateMock::isReadConcernSnapshotSupportedBySt return true; } -std::size_t ReplicationCoordinatorExternalStateMock::getOplogFetcherMaxFetcherRestarts() const { +std::size_t ReplicationCoordinatorExternalStateMock::getOplogFetcherSteadyStateMaxFetcherRestarts() + const { + return 0; +} + +std::size_t ReplicationCoordinatorExternalStateMock::getOplogFetcherInitialSyncMaxFetcherRestarts() + const { return 0; } diff --git a/src/mongo/db/repl/replication_coordinator_external_state_mock.h b/src/mongo/db/repl/replication_coordinator_external_state_mock.h index 8440b286661..e8169616079 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_mock.h +++ b/src/mongo/db/repl/replication_coordinator_external_state_mock.h @@ -94,7 +94,8 @@ public: virtual double getElectionTimeoutOffsetLimitFraction() const; virtual bool isReadCommittedSupportedByStorageEngine(OperationContext* opCtx) const; virtual bool isReadConcernSnapshotSupportedByStorageEngine(OperationContext* opCtx) const; - virtual std::size_t getOplogFetcherMaxFetcherRestarts() const override; + virtual std::size_t getOplogFetcherSteadyStateMaxFetcherRestarts() const override; + virtual std::size_t getOplogFetcherInitialSyncMaxFetcherRestarts() const override; /** * Adds "host" to the list of hosts that this mock will match when responding to "isSelf" diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index f65975365a1..b6d02ba07c0 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -320,7 +320,8 @@ InitialSyncerOptions createInitialSyncerOptions( }; options.resetOptimes = [replCoord]() { replCoord->resetMyLastOpTimes(); }; options.syncSourceSelector = replCoord; - options.oplogFetcherMaxFetcherRestarts = externalState->getOplogFetcherMaxFetcherRestarts(); + options.oplogFetcherMaxFetcherRestarts = + externalState->getOplogFetcherInitialSyncMaxFetcherRestarts(); return options; } } // namespace |