diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2018-10-11 18:24:20 -0400 |
---|---|---|
committer | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2018-10-11 18:24:20 -0400 |
commit | 0272ec068f5da65458d7a081beac583b33b610d1 (patch) | |
tree | 681334367ffc8b799f54ab61f064ace04e76fb68 /src/mongo/db/index_builder.cpp | |
parent | 34de1953a9575f2745a1f430f5eb7ce2a6014031 (diff) | |
download | mongo-0272ec068f5da65458d7a081beac583b33b610d1.tar.gz |
SERVER-37055 IndexBuildBlock::fail() should grab a lock
Diffstat (limited to 'src/mongo/db/index_builder.cpp')
-rw-r--r-- | src/mongo/db/index_builder.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/index_builder.cpp b/src/mongo/db/index_builder.cpp index f5d4fa472d2..d4ef6171228 100644 --- a/src/mongo/db/index_builder.cpp +++ b/src/mongo/db/index_builder.cpp @@ -232,6 +232,13 @@ Status IndexBuilder::_build(OperationContext* opCtx, status = indexer.insertAllDocumentsInCollection(); } if (!status.isOK()) { + if (allowBackgroundBuilding) { + UninterruptibleLockGuard noInterrupt(opCtx->lockState()); + dbLock->relockWithMode(MODE_X); + if (status == ErrorCodes::InterruptedAtShutdown) + return _failIndexBuild(indexer, status, allowBackgroundBuilding); + opCtx->checkForInterrupt(); + } return _failIndexBuild(indexer, status, allowBackgroundBuilding); } |