summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2020-05-12 13:58:45 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-12 20:20:47 +0000
commit56b6e3132abf3f9efdb579081053b083323790de (patch)
tree53c15d39c9cdf4c2d53e3be02e20e277589bb301
parent1c9a43aa1e3801f09b2323d9290b60a37056269e (diff)
downloadmongo-56b6e3132abf3f9efdb579081053b083323790de.tar.gz
SERVER-48152 renameCollectionAndDropTarget() should check for background operations before calling preRenameCollection()
(cherry picked from commit c4c5768798b72027a7b40eb0bbf4455f7e9564b9)
-rw-r--r--src/mongo/db/catalog/rename_collection.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/db/catalog/rename_collection.cpp b/src/mongo/db/catalog/rename_collection.cpp
index 90893a6e99b..6cb5582fc7f 100644
--- a/src/mongo/db/catalog/rename_collection.cpp
+++ b/src/mongo/db/catalog/rename_collection.cpp
@@ -245,6 +245,10 @@ Status renameCollectionAndDropTarget(OperationContext* opCtx,
invariant(renameOpTimeFromApplyOps.isNull());
}
+ BackgroundOperation::assertNoBgOpInProgForNs(targetColl->ns().ns());
+ IndexBuildsCoordinator::get(opCtx)->assertNoIndexBuildInProgForCollection(
+ targetColl->uuid());
+
auto numRecords = targetColl->numRecords(opCtx);
auto opObserver = opCtx->getServiceContext()->getOpObserver();
auto renameOpTime = opObserver->preRenameCollection(
@@ -268,10 +272,6 @@ Status renameCollectionAndDropTarget(OperationContext* opCtx,
// No logOp necessary because the entire renameCollection command is one logOp.
repl::UnreplicatedWritesBlock uwb(opCtx);
- BackgroundOperation::assertNoBgOpInProgForNs(targetColl->ns().ns());
- IndexBuildsCoordinator::get(opCtx)->assertNoIndexBuildInProgForCollection(
- targetColl->uuid());
-
auto status = db->dropCollection(opCtx, targetColl->ns(), renameOpTime);
if (!status.isOK())
return status;