summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/initial_syncer.cpp
diff options
context:
space:
mode:
authorMatthew Russotto <matthew.russotto@mongodb.com>2020-01-22 19:09:51 +0000
committerevergreen <evergreen@mongodb.com>2020-01-22 19:09:51 +0000
commitc9b6ffbc8de0d865ebd1e9a196cee3516efa12e7 (patch)
tree3aa23a8f53bc861f6539a2246b06e008d5f80dc1 /src/mongo/db/repl/initial_syncer.cpp
parentd1c386904123e7a200f3a4ee2e33dc21b52e5031 (diff)
downloadmongo-c9b6ffbc8de0d865ebd1e9a196cee3516efa12e7.tar.gz
SERVER-45423 Use isRetriableError instead of isNetworkError for transient errors in initial sync
Diffstat (limited to 'src/mongo/db/repl/initial_syncer.cpp')
-rw-r--r--src/mongo/db/repl/initial_syncer.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mongo/db/repl/initial_syncer.cpp b/src/mongo/db/repl/initial_syncer.cpp
index 08c54f5738f..0c9bda496d3 100644
--- a/src/mongo/db/repl/initial_syncer.cpp
+++ b/src/mongo/db/repl/initial_syncer.cpp
@@ -299,7 +299,7 @@ void InitialSyncer::_cancelRemainingWork_inlock() {
_shutdownComponent_inlock(_oplogFetcher);
if (_sharedData) {
// We actually hold the required lock, but the lock object itself is not passed through.
- _clearNetworkError(WithLock::withoutLock());
+ _clearRetriableError(WithLock::withoutLock());
stdx::lock_guard<InitialSyncSharedData> lock(*_sharedData);
_sharedData->setInitialSyncStatusIfOK(
lock, Status{ErrorCodes::CallbackCanceled, "Initial sync attempt canceled"});
@@ -1192,7 +1192,7 @@ void InitialSyncer::_lastOplogEntryFetcherCallbackForStopTimestamp(
stdx::lock_guard<Latch> lock(_mutex);
auto status = _checkForShutdownAndConvertStatus_inlock(
result.getStatus(), "error fetching last oplog entry for stop timestamp");
- if (_shouldRetryNetworkError(lock, status)) {
+ if (_shouldRetryError(lock, status)) {
auto scheduleStatus = _exec->scheduleWork(
[this, onCompletionGuard](executor::TaskExecutor::CallbackArgs args) {
// It is not valid to schedule the retry from within this callback,
@@ -1417,7 +1417,7 @@ void InitialSyncer::_rollbackCheckerCheckForRollbackCallback(
stdx::lock_guard<Latch> lock(_mutex);
auto status = _checkForShutdownAndConvertStatus_inlock(result.getStatus(),
"error while getting last rollback ID");
- if (_shouldRetryNetworkError(lock, status)) {
+ if (_shouldRetryError(lock, status)) {
LOG(1) << "Retrying rollback checker because of network error " << status;
_scheduleRollbackCheckerCheckForRollback_inlock(lock, onCompletionGuard);
return;
@@ -1712,18 +1712,18 @@ void InitialSyncer::_scheduleRollbackCheckerCheckForRollback_inlock(
return;
}
-bool InitialSyncer::_shouldRetryNetworkError(WithLock lk, Status status) {
- if (ErrorCodes::isNetworkError(status)) {
+bool InitialSyncer::_shouldRetryError(WithLock lk, Status status) {
+ if (ErrorCodes::isRetriableError(status)) {
stdx::lock_guard<InitialSyncSharedData> sharedDataLock(*_sharedData);
return _sharedData->shouldRetryOperation(sharedDataLock, &_retryingOperation);
}
- // The status was OK or some error other than a network error, so clear the network error
+ // The status was OK or some error other than a retriable error, so clear the retriable error
// state and indicate that we should not retry.
- _clearNetworkError(lk);
+ _clearRetriableError(lk);
return false;
}
-void InitialSyncer::_clearNetworkError(WithLock lk) {
+void InitialSyncer::_clearRetriableError(WithLock lk) {
_retryingOperation = boost::none;
}
@@ -1919,7 +1919,7 @@ void InitialSyncer::InitialSyncAttemptInfo::append(BSONObjBuilder* builder) cons
bool InitialSyncer::OplogFetcherRestartDecisionInitialSyncer::shouldContinue(
AbstractOplogFetcher* fetcher, Status status) {
- if (ErrorCodes::isNetworkError(status)) {
+ if (ErrorCodes::isRetriableError(status)) {
stdx::lock_guard<InitialSyncSharedData> lk(*_sharedData);
return _sharedData->shouldRetryOperation(lk, &_retryingOperation);
}