summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Pulo <kevin.pulo@mongodb.com>2019-09-26 18:14:42 +0000
committerevergreen <evergreen@mongodb.com>2019-09-26 18:14:42 +0000
commit5c5088b0a184ed6993735ffdb37de5025b57a456 (patch)
treec083b1e0f00c91a03471306f09487a9768a4af54
parent9dd6da3bc2e80cb4cf1736f30b1022b4594d4a72 (diff)
downloadmongo-5c5088b0a184ed6993735ffdb37de5025b57a456.tar.gz
SERVER-36315 Don't keep trying to unlock distlocks after CSRS stepdown
(cherry picked from commit 3197ace779d6e0f023bff9e39bd80e17e3c4790d)
-rw-r--r--src/mongo/s/catalog/replset_dist_lock_manager.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/s/catalog/replset_dist_lock_manager.cpp b/src/mongo/s/catalog/replset_dist_lock_manager.cpp
index 81bef3cfa13..890f4b839f3 100644
--- a/src/mongo/s/catalog/replset_dist_lock_manager.cpp
+++ b/src/mongo/s/catalog/replset_dist_lock_manager.cpp
@@ -168,7 +168,10 @@ void ReplSetDistLockManager::doTask() {
if (!unlockStatus.isOK()) {
warning() << "Failed to unlock lock with " << LocksType::lockID() << ": "
<< toUnlock.first << nameMessage << causedBy(unlockStatus);
- queueUnlock(toUnlock.first, toUnlock.second);
+ // Queue another attempt, unless the problem was no longer being primary.
+ if (unlockStatus != ErrorCodes::NotMaster) {
+ queueUnlock(toUnlock.first, toUnlock.second);
+ }
} else {
LOG(0) << "distributed lock with " << LocksType::lockID() << ": "
<< toUnlock.first << nameMessage << " unlocked.";