summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/rename_collection.cpp
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 19:38:02 +0000
commitc4c5768798b72027a7b40eb0bbf4455f7e9564b9 (patch)
tree7393ff855e183cb95ca397f944006f4c6c254d11 /src/mongo/db/catalog/rename_collection.cpp
parent694b92620fe581f57ed78ca9c4c59ece4d5b9a74 (diff)
downloadmongo-c4c5768798b72027a7b40eb0bbf4455f7e9564b9.tar.gz
SERVER-48152 renameCollectionAndDropTarget() should check for background operations before calling preRenameCollection()
Diffstat (limited to 'src/mongo/db/catalog/rename_collection.cpp')
-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 d398b5eb188..24b9f9cbb6b 100644
--- a/src/mongo/db/catalog/rename_collection.cpp
+++ b/src/mongo/db/catalog/rename_collection.cpp
@@ -241,6 +241,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(
@@ -264,10 +268,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;