summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Mulrow <jack.mulrow@mongodb.com>2021-05-02 19:12:10 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-05-05 01:56:20 +0000
commit1261c92d8a9fa97f5154d40866e41b34723af9cf (patch)
treef81fab2cdc9beec9a9e5ca27f38e55722ee268fd
parent5432326eb039374337e3780406dcf4646e69d1b8 (diff)
downloadmongo-1261c92d8a9fa97f5154d40866e41b34723af9cf.tar.gz
SERVER-56435 Tenant migration donor shouldn't abort on shutdown or not primary errors
(cherry picked from commit 6b780f53b473a8f23042095642b1888bf3a2b237)
-rw-r--r--src/mongo/db/repl/tenant_migration_donor_service.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/mongo/db/repl/tenant_migration_donor_service.cpp b/src/mongo/db/repl/tenant_migration_donor_service.cpp
index 32338d38557..1ea94b3575e 100644
--- a/src/mongo/db/repl/tenant_migration_donor_service.cpp
+++ b/src/mongo/db/repl/tenant_migration_donor_service.cpp
@@ -1142,15 +1142,14 @@ ExecutorFuture<void> TenantMigrationDonorService::Instance::_handleErrorOrEnterA
// Fulfill the promise since the state doc failed to insert.
setPromiseErrorIfNotReady(lg, _initialDonorStateDurablePromise, status);
- return ExecutorFuture<void>(**executor, status);
- } else if (status == ErrorCodes::PrimarySteppedDown) {
- // The node started stepping down while the instance was waiting for key docs to
- // to replicate. Do not abort the migration since the migration can safely resume
- // when the new primary steps up.
+ return ExecutorFuture(**executor);
+ } else if (ErrorCodes::isNotPrimaryError(status) || ErrorCodes::isShutdownError(status)) {
+ // Don't abort the migration on retriable errors that may have been generated by the local
+ // server shutting/stepping down because it can be resumed when the client retries.
stdx::lock_guard<Latch> lg(_mutex);
setPromiseErrorIfNotReady(lg, _initialDonorStateDurablePromise, status);
- return ExecutorFuture<void>(**executor, status);
+ return ExecutorFuture(**executor);
} else {
// Enter "abort" state.
_abortReason.emplace(status);