diff options
-rw-r--r-- | src/mongo/db/repl/collection_cloner.cpp | 22 | ||||
-rw-r--r-- | src/mongo/db/repl/data_replicator.cpp | 12 | ||||
-rw-r--r-- | src/mongo/db/repl/database_cloner.cpp | 11 |
3 files changed, 41 insertions, 4 deletions
diff --git a/src/mongo/db/repl/collection_cloner.cpp b/src/mongo/db/repl/collection_cloner.cpp index 177756e9a1b..ea07e3c564b 100644 --- a/src/mongo/db/repl/collection_cloner.cpp +++ b/src/mongo/db/repl/collection_cloner.cpp @@ -32,6 +32,7 @@ #include "mongo/db/repl/collection_cloner.h" +#include "mongo/client/remote_command_retry_scheduler.h" #include "mongo/db/catalog/collection_options.h" #include "mongo/db/namespace_string.h" #include "mongo/db/repl/storage_interface.h" @@ -48,6 +49,10 @@ namespace { using LockGuard = stdx::lock_guard<stdx::mutex>; using UniqueLock = stdx::unique_lock<stdx::mutex>; +// The number of retries for the listIndexes commands. +const size_t numListIndexesRetries = 1; +// The number of retries for the find command, which gets the data. +const size_t numFindRetries = 3; } // namespace CollectionCloner::CollectionCloner(ReplicationExecutor* executor, @@ -72,7 +77,13 @@ CollectionCloner::CollectionCloner(ReplicationExecutor* executor, this, stdx::placeholders::_1, stdx::placeholders::_2, - stdx::placeholders::_3)), + stdx::placeholders::_3), + rpc::ServerSelectionMetadata(true, boost::none).toBSON(), + RemoteCommandRequest::kNoTimeout, + RemoteCommandRetryScheduler::makeRetryPolicy( + numListIndexesRetries, + executor::RemoteCommandRequest::kNoTimeout, + RemoteCommandRetryScheduler::kAllRetriableErrors)), _findFetcher(_executor, _source, _sourceNss.db().toString(), @@ -81,7 +92,14 @@ CollectionCloner::CollectionCloner(ReplicationExecutor* executor, this, stdx::placeholders::_1, stdx::placeholders::_2, - stdx::placeholders::_3)), + stdx::placeholders::_3), + rpc::ServerSelectionMetadata(true, boost::none).toBSON(), + RemoteCommandRequest::kNoTimeout, + RemoteCommandRetryScheduler::makeRetryPolicy( + numFindRetries, + executor::RemoteCommandRequest::kNoTimeout, + RemoteCommandRetryScheduler::kAllRetriableErrors)), + _indexSpecs(), _documents(), _dbWorkCallbackHandle(), diff --git a/src/mongo/db/repl/data_replicator.cpp b/src/mongo/db/repl/data_replicator.cpp index 7786e028856..a1f96c4fb1a 100644 --- a/src/mongo/db/repl/data_replicator.cpp +++ b/src/mongo/db/repl/data_replicator.cpp @@ -36,6 +36,7 @@ #include "mongo/base/status.h" #include "mongo/client/fetcher.h" +#include "mongo/client/remote_command_retry_scheduler.h" #include "mongo/db/concurrency/d_concurrency.h" #include "mongo/db/jsobj.h" #include "mongo/db/namespace_string.h" @@ -95,6 +96,9 @@ using QueryResponseStatus = StatusWith<Fetcher::QueryResponse>; using UniqueLock = stdx::unique_lock<stdx::mutex>; using LockGuard = stdx::lock_guard<stdx::mutex>; +// The number of retries for the find command. +const size_t numFindRetries = 3; + ServiceContext::UniqueOperationContext makeOpCtx() { return cc().makeOperationContext(); } @@ -760,7 +764,13 @@ void DataReplicator::_onDataClonerFinish(const Status& status) { _syncSource, _opts.remoteOplogNS.db().toString(), query, - stdx::bind(&DataReplicator::_onApplierReadyStart, this, stdx::placeholders::_1)); + stdx::bind(&DataReplicator::_onApplierReadyStart, this, stdx::placeholders::_1), + rpc::ServerSelectionMetadata(true, boost::none).toBSON(), + RemoteCommandRequest::kNoTimeout, + RemoteCommandRetryScheduler::makeRetryPolicy( + numFindRetries, + executor::RemoteCommandRequest::kNoTimeout, + RemoteCommandRetryScheduler::kAllRetriableErrors)); Status scheduleStatus = _lastOplogEntryFetcher->schedule(); if (!scheduleStatus.isOK()) { _initialSyncState->status = scheduleStatus; diff --git a/src/mongo/db/repl/database_cloner.cpp b/src/mongo/db/repl/database_cloner.cpp index 25e74a383c4..89c5d7b3da6 100644 --- a/src/mongo/db/repl/database_cloner.cpp +++ b/src/mongo/db/repl/database_cloner.cpp @@ -36,6 +36,7 @@ #include <iterator> #include <set> +#include "mongo/client/remote_command_retry_scheduler.h" #include "mongo/db/catalog/collection_options.h" #include "mongo/db/repl/storage_interface.h" #include "mongo/rpc/metadata/server_selection_metadata.h" @@ -56,6 +57,9 @@ using UniqueLock = stdx::unique_lock<stdx::mutex>; const char* kNameFieldName = "name"; const char* kOptionsFieldName = "options"; +// The number of retries for the listCollections commands. +const int numListCollectionsRetries = 1; + /** * Default listCollections predicate. */ @@ -102,7 +106,12 @@ DatabaseCloner::DatabaseCloner(ReplicationExecutor* executor, stdx::placeholders::_1, stdx::placeholders::_2, stdx::placeholders::_3), - rpc::ServerSelectionMetadata(true, boost::none).toBSON()), + rpc::ServerSelectionMetadata(true, boost::none).toBSON(), + RemoteCommandRequest::kNoTimeout, + RemoteCommandRetryScheduler::makeRetryPolicy( + numListCollectionsRetries, + executor::RemoteCommandRequest::kNoTimeout, + RemoteCommandRetryScheduler::kAllRetriableErrors)), _scheduleDbWorkFn([this](const ReplicationExecutor::CallbackFn& work) { return _executor->scheduleDBWork(work); }), |