summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/s/active_migrations_registry.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/s/active_migrations_registry.cpp b/src/mongo/db/s/active_migrations_registry.cpp
index 70cab089b64..ede2817f8bf 100644
--- a/src/mongo/db/s/active_migrations_registry.cpp
+++ b/src/mongo/db/s/active_migrations_registry.cpp
@@ -39,6 +39,7 @@
#include "mongo/db/s/migration_source_manager.h"
#include "mongo/db/service_context.h"
#include "mongo/logv2/log.h"
+#include "mongo/util/scopeguard.h"
namespace mongo {
namespace {
@@ -72,10 +73,14 @@ void ActiveMigrationsRegistry::lock(OperationContext* opCtx, StringData reason)
LOGV2(467560, "Going to start blocking migrations", "reason"_attr = reason);
_migrationsBlocked = true;
+ auto unblockMigrationsOnError = makeGuard([&] { _migrationsBlocked = false; });
+
// Wait for any ongoing chunk modifications to complete
opCtx->waitForConditionOrInterrupt(_chunkOperationsStateChangedCV, lock, [this] {
return !(_activeMoveChunkState || _activeReceiveChunkState);
});
+
+ unblockMigrationsOnError.dismiss();
}
void ActiveMigrationsRegistry::unlock(StringData reason) {