summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/s/migration_destination_manager.cpp9
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();