summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlake Oler <blake.oler@mongodb.com>2019-02-11 16:25:46 -0500
committerBlake Oler <blake.oler@mongodb.com>2019-02-12 11:12:15 -0500
commit9d06566d7f8c9affbadd2bb9c54bb94457863dd0 (patch)
tree6d07c586238ceea8f578507348a4932ddb016ca1
parent1760b0f15343050158742ecbc1ab6ece9e75b5d9 (diff)
downloadmongo-9d06566d7f8c9affbadd2bb9c54bb94457863dd0.tar.gz
SERVER-38344 Hold database distlocks during migration and split
-rw-r--r--src/mongo/db/s/config/configsvr_shard_collection_command.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mongo/db/s/config/configsvr_shard_collection_command.cpp b/src/mongo/db/s/config/configsvr_shard_collection_command.cpp
index 64b2249fbfb..a42e0b87659 100644
--- a/src/mongo/db/s/config/configsvr_shard_collection_command.cpp
+++ b/src/mongo/db/s/config/configsvr_shard_collection_command.cpp
@@ -895,15 +895,17 @@ public:
// Make sure the cached metadata for the collection knows that we are now sharded
catalogCache->invalidateShardedCollection(nss);
- // Free the distlocks to allow the splits and migrations below to proceed.
+ // Free the collection distlock to allow the splits and migrations below to proceed. These
+ // operations do not take the database distlocks.
collDistLock.reset();
- dbDistLock.reset();
- backwardsCompatibleDbDistLock.reset();
// Step 7. Migrate initial chunks to distribute them across shards.
migrateAndFurtherSplitInitialChunks(
opCtx, nss, numShards, shardIds, isEmpty, shardKeyPattern, allSplits);
+ dbDistLock.reset();
+ backwardsCompatibleDbDistLock.reset();
+
return true;
}