summaryrefslogtreecommitdiff
path: root/src/mongo/db/index_builder.cpp
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2018-10-11 18:24:20 -0400
committerGregory Wlodarek <gregory.wlodarek@mongodb.com>2018-10-11 18:24:20 -0400
commit0272ec068f5da65458d7a081beac583b33b610d1 (patch)
tree681334367ffc8b799f54ab61f064ace04e76fb68 /src/mongo/db/index_builder.cpp
parent34de1953a9575f2745a1f430f5eb7ce2a6014031 (diff)
downloadmongo-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.cpp7
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);
}