diff options
author | Louis Williams <louis.williams@mongodb.com> | 2018-05-31 16:27:07 -0400 |
---|---|---|
committer | Louis Williams <louis.williams@mongodb.com> | 2018-05-31 18:07:46 -0400 |
commit | 9c9af164a0e3a71716829174eadb1000edcd0a6a (patch) | |
tree | 675ae9929eb23ae7b894b7d1c75893b399ed1725 /src/mongo/db | |
parent | 5a7d11513368a65014eaf387afdf76d4f48aa4ac (diff) | |
download | mongo-9c9af164a0e3a71716829174eadb1000edcd0a6a.tar.gz |
SERVER-35321 Make renameCollection uninterruptible
(cherry picked from commit 3b293072e869d4e01de658cf17c6b09afc081d0b)
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/catalog/rename_collection.cpp | 4 |
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()); |