summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDianna Hohensee <dianna.hohensee@10gen.com>2018-04-27 14:18:29 -0400
committerDianna Hohensee <dianna.hohensee@10gen.com>2018-04-27 17:12:40 -0400
commit7c25d109bda4c56cc329ee4f1a1521a2f9bc690a (patch)
treeb90f9ad7164fb9944d7c9f60d6a497368f6d8f43
parent8bd820b1418fd1811ed7c79bbd60bbb2c9d7cb5c (diff)
downloadmongo-7c25d109bda4c56cc329ee4f1a1521a2f9bc690a.tar.gz
SERVER-34591 Add an UninterruptibleLockGuard to the MultiIndexBlockImpl destructor
-rw-r--r--src/mongo/db/catalog/index_create_impl.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mongo/db/catalog/index_create_impl.cpp b/src/mongo/db/catalog/index_create_impl.cpp
index fb400c659fc..aa04c84b8e9 100644
--- a/src/mongo/db/catalog/index_create_impl.cpp
+++ b/src/mongo/db/catalog/index_create_impl.cpp
@@ -175,17 +175,18 @@ MultiIndexBlockImpl::~MultiIndexBlockImpl() {
while (true) {
try {
WriteUnitOfWork wunit(_opCtx);
- // This cleans up all index builds.
- // Because that may need to write, it is done inside
- // of a WUOW. Nothing inside this block can fail, and it is made fatal if it does.
+ // This cleans up all index builds. Because that may need to write, it is done inside of
+ // a WUOW. Nothing inside this block can fail, and it is made fatal if it does.
for (size_t i = 0; i < _indexes.size(); i++) {
_indexes[i].block->fail();
}
auto replCoord = repl::ReplicationCoordinator::get(_opCtx);
if (replCoord->canAcceptWritesForDatabase(_opCtx, "admin")) {
- // Primaries must timestamp the failure of an index build (via an op
- // message). Secondaries may not fail index builds.
+ // Primaries must timestamp the failure of an index build (via an op message).
+ // Secondaries may not fail index builds.
+ // Make lock acquisition uninterruptible because writing an op message takes a lock.
+ UninterruptibleLockGuard(_opCtx->lockState());
_opCtx->getServiceContext()->getOpObserver()->onOpMessage(
_opCtx,
BSON("msg" << std::string(str::stream() << "Failing index builds. Coll: "