From a2343b191e3a0edf93cc7e9f22b8434d1f2a7c0d Mon Sep 17 00:00:00 2001 From: Kevin Pulo Date: Thu, 26 Sep 2019 18:06:42 +0000 Subject: SERVER-36315 Don't keep trying to unlock distlocks after CSRS stepdown (cherry picked from commit 3197ace779d6e0f023bff9e39bd80e17e3c4790d) --- src/mongo/s/catalog/replset_dist_lock_manager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mongo/s/catalog/replset_dist_lock_manager.cpp b/src/mongo/s/catalog/replset_dist_lock_manager.cpp index 5e3e22fd51a..a28b5136e98 100644 --- a/src/mongo/s/catalog/replset_dist_lock_manager.cpp +++ b/src/mongo/s/catalog/replset_dist_lock_manager.cpp @@ -164,7 +164,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."; -- cgit v1.2.1