summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Pulo <kevin.pulo@mongodb.com>2019-09-26 18:15:41 +0000
committerevergreen <evergreen@mongodb.com>2019-09-26 18:15:41 +0000
commit21381250dede7f387ffe41a6ccba71a498492831 (patch)
treeeea500d6a2346fa7cc99525c073404d9c5094361
parent1ab703f5bfa255c4f7fb0641bc20165f00c44161 (diff)
downloadmongo-21381250dede7f387ffe41a6ccba71a498492831.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 5c24eb292b2..1acf415e603 100644
--- a/src/mongo/s/catalog/replset_dist_lock_manager.cpp
+++ b/src/mongo/s/catalog/replset_dist_lock_manager.cpp
@@ -165,7 +165,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.";