diff options
author | Cheahuychou Mao <mao.cheahuychou@gmail.com> | 2021-07-06 22:09:43 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-07-07 02:02:31 +0000 |
commit | bdb25818f676fb91e8862b2670c2f442b84ffb84 (patch) | |
tree | e27954f285cc9bf42c40ce32314d832cdb1cafdd | |
parent | 9302236810ec2266aaf76e91f0e5208a539155d7 (diff) | |
download | mongo-bdb25818f676fb91e8862b2670c2f442b84ffb84.tar.gz |
SERVER-58306 chunkInserter thread can terminate() if checkForInterrupt() is called after stepdown has killed the opCtx
-rw-r--r-- | src/mongo/db/s/migration_destination_manager.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/s/migration_destination_manager.cpp b/src/mongo/db/s/migration_destination_manager.cpp index 4478a436733..0f713b99f1c 100644 --- a/src/mongo/db/s/migration_destination_manager.cpp +++ b/src/mongo/db/s/migration_destination_manager.cpp @@ -488,10 +488,6 @@ repl::OpTime MigrationDestinationManager::cloneDocumentsFromDonor( } auto inserterOpCtx = cc().makeOperationContext(); inserterOpCtx->setAlwaysInterruptAtStepDownOrUp(); - { - stdx::lock_guard<Client> lk(*opCtx->getClient()); - opCtx->checkForInterrupt(); - } auto consumerGuard = makeGuard([&] { batches.closeConsumerEnd(); @@ -499,6 +495,11 @@ repl::OpTime MigrationDestinationManager::cloneDocumentsFromDonor( }); try { + { + stdx::lock_guard<Client> lk(*opCtx->getClient()); + opCtx->checkForInterrupt(); + } + while (true) { auto nextBatch = batches.pop(inserterOpCtx.get()); auto arr = nextBatch["objects"].Obj(); |