summaryrefslogtreecommitdiff
path: root/src/mongo/s/catalog/replset_dist_lock_manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/catalog/replset_dist_lock_manager.cpp')
-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.";