summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/replication_coordinator_impl.cpp
diff options
context:
space:
mode:
authorLouis Williams <louis.williams@mongodb.com>2018-03-28 13:39:45 -0400
committerLouis Williams <louis.williams@mongodb.com>2018-04-30 11:50:37 -0400
commit07d7a7095a7ebb116b0d02a4ac396620710e9e77 (patch)
treef17d474d953d49cc1d5d130a8a6c38fd975d10a2 /src/mongo/db/repl/replication_coordinator_impl.cpp
parent3d43d9420c12c2f47d614fc6f2546cf80742817e (diff)
downloadmongo-07d7a7095a7ebb116b0d02a4ac396620710e9e77.tar.gz
SERVER-33674 Require GlobalLocks with deadlines to specify interrupt behavior when interrupted
Diffstat (limited to 'src/mongo/db/repl/replication_coordinator_impl.cpp')
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index 1ecb7e6fee2..4f3e7d58526 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -1606,8 +1606,11 @@ Status ReplicationCoordinatorImpl::stepDown(OperationContext* opCtx,
return {ErrorCodes::NotMaster, "not primary so can't step down"};
}
- auto globalLock = stdx::make_unique<Lock::GlobalLock>(
- opCtx, MODE_X, stepDownUntil, Lock::GlobalLock::EnqueueOnly());
+ auto globalLock = stdx::make_unique<Lock::GlobalLock>(opCtx,
+ MODE_X,
+ stepDownUntil,
+ Lock::InterruptBehavior::kThrow,
+ Lock::GlobalLock::EnqueueOnly());
// We've requested the global exclusive lock which will stop new operations from coming in,
// but existing operations could take a long time to finish, so kill all user operations
@@ -1718,7 +1721,7 @@ Status ReplicationCoordinatorImpl::stepDown(OperationContext* opCtx,
// to acquire it now. For the same reason, we also disable lock acquisition
// interruption, to guarantee that we get the lock eventually.
UninterruptibleLockGuard noInterrupt(opCtx->lockState());
- globalLock.reset(new Lock::GlobalLock(opCtx, MODE_X, Date_t::max()));
+ globalLock.reset(new Lock::GlobalLock(opCtx, MODE_X));
invariant(globalLock->isLocked());
lk.lock();
});