diff options
-rw-r--r-- | src/mongo/s/catalog/replset_dist_lock_manager.cpp | 5 |
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 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."; |