diff options
author | Andrew Shuvalov <andrew.shuvalov@mongodb.com> | 2021-02-03 01:02:54 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-11 01:54:38 +0000 |
commit | db4c86fb6f59d81a8b74cff41096b9ee6066fe30 (patch) | |
tree | 7faa59cbdfcc465aa7adde2b732a75b130cc9c70 /src/mongo/db/commands | |
parent | 8aea774eb7a9bb4774dcd202eef97814a9a46cc6 (diff) | |
download | mongo-db4c86fb6f59d81a8b74cff41096b9ee6066fe30.tar.gz |
SERVER-53950: fix ASAN errors when migration recipient is stuck on step down
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r-- | src/mongo/db/commands/tenant_migration_donor_cmds.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/commands/tenant_migration_recipient_cmds.cpp | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/db/commands/tenant_migration_donor_cmds.cpp b/src/mongo/db/commands/tenant_migration_donor_cmds.cpp index 1570f370213..5e239bbe97d 100644 --- a/src/mongo/db/commands/tenant_migration_donor_cmds.cpp +++ b/src/mongo/db/commands/tenant_migration_donor_cmds.cpp @@ -98,12 +98,14 @@ public: auto durableState = [&] { try { return donor->getDurableState(opCtx); - } catch (ExceptionFor<ErrorCodes::ConflictingOperationInProgress>&) { + } catch (ExceptionFor<ErrorCodes::ConflictingOperationInProgress>& ex) { // The conflict is discovered while inserting the donor instance's state doc. // This implies that there is no other instance with the same migrationId, but // there is another instance with the same tenantId. Therefore, the instance // above was created by this command, so remove it. - donorService->releaseInstance(stateDocBson["_id"].wrap()); + // The status from this exception will be passed to the instance interrupt() + // method. + donorService->releaseInstance(stateDocBson["_id"].wrap(), ex.toStatus()); throw; } }(); diff --git a/src/mongo/db/commands/tenant_migration_recipient_cmds.cpp b/src/mongo/db/commands/tenant_migration_recipient_cmds.cpp index 0dc4c19db20..0ca25375e55 100644 --- a/src/mongo/db/commands/tenant_migration_recipient_cmds.cpp +++ b/src/mongo/db/commands/tenant_migration_recipient_cmds.cpp @@ -110,12 +110,13 @@ public: return Response(recipientInstance->waitUntilTimestampIsMajorityCommitted( opCtx, *returnAfterReachingDonorTs)); - } catch (ExceptionFor<ErrorCodes::ConflictingOperationInProgress>&) { + } catch (ExceptionFor<ErrorCodes::ConflictingOperationInProgress>& ex) { // A conflict may arise when inserting the recipientInstance's state document. // Since the conflict occurred at the insert stage, that means this instance's // tenantId conflicts with an existing instance's tenantId. Therefore, remove the // instance that was just created. - recipientService->releaseInstance(stateDocBson["_id"].wrap()); + // The status from this exception will be passed to the instance interrupt() method. + recipientService->releaseInstance(stateDocBson["_id"].wrap(), ex.toStatus()); throw; } } |