summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Williams <louis.williams@mongodb.com>2018-05-31 16:27:07 -0400
committerLouis Williams <louis.williams@mongodb.com>2018-05-31 17:16:29 -0400
commit3b293072e869d4e01de658cf17c6b09afc081d0b (patch)
tree3c81ce83ed1a186a7c575635a8c04c2ba41b6477
parent8184571d846ba08f625e0b779620d6ffa2e75da0 (diff)
downloadmongo-3b293072e869d4e01de658cf17c6b09afc081d0b.tar.gz
SERVER-35321 Make renameCollection uninterruptible
-rw-r--r--src/mongo/db/catalog/rename_collection.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/rename_collection.cpp b/src/mongo/db/catalog/rename_collection.cpp
index 6203a4dea96..c41ea778782 100644
--- a/src/mongo/db/catalog/rename_collection.cpp
+++ b/src/mongo/db/catalog/rename_collection.cpp
@@ -134,6 +134,10 @@ Status renameCollectionCommon(OperationContext* opCtx,
else if (!lockState->isW())
globalWriteLock.emplace(opCtx);
+ // Allow the MODE_X lock above to be interrupted, but rename is not resilient to interruption
+ // when the onRenameCollection OpObserver takes an oplog collection lock.
+ UninterruptibleLockGuard noInterrupt(opCtx->lockState());
+
// We stay in source context the whole time. This is mostly to set the CurOp namespace.
boost::optional<OldClientContext> ctx;
ctx.emplace(opCtx, source.ns());