summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/repl/replication_coordinator_external_state_impl.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
index 15484b6729f..f1e0e16e399 100644
--- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
@@ -694,6 +694,10 @@ void ReplicationCoordinatorExternalStateImpl::_shardingOnTransitionToPrimaryHook
<< causedBy(shardAwareInitializationStatus);
}
+ // Free any leftover locks from previous instantiations.
+ auto distLockManager = Grid::get(txn)->catalogClient(txn)->getDistLockManager();
+ distLockManager->unlockAll(txn, distLockManager->getProcessID());
+
// If this is a config server node becoming a primary, start the balancer
Balancer::get(txn)->startThread(txn);
} else if (ShardingState::get(txn)->enabled()) {