diff options
author | Allison Easton <allison.easton@mongodb.com> | 2022-02-25 10:42:47 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-25 11:09:50 +0000 |
commit | f2fca650993b81e6083a51ae411c272074a82c38 (patch) | |
tree | 624ef88b72fb19df2c8b20b5cdda42bd26c9d870 | |
parent | ba526142d5b80aee629161dc5754fd928833daa3 (diff) | |
download | mongo-f2fca650993b81e6083a51ae411c272074a82c38.tar.gz |
SERVER-63905 ConfigureCollectionBalancing command should refresh collection routing info
-rw-r--r-- | src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp b/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp index fb34606a968..aafe803ef45 100644 --- a/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp +++ b/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp @@ -609,7 +609,11 @@ void ShardingCatalogManager::configureCollectionBalancing( return; } - const auto cm = Grid::get(opCtx)->catalogCache()->getShardedCollectionRoutingInfo(opCtx, nss); + // Take _kChunkOpLock in exclusive mode to prevent concurrent chunk splits, merges, and + // migrations + Lock::ExclusiveLock lk(opCtx, opCtx->lockState(), _kChunkOpLock); + const auto cm = uassertStatusOK( + Grid::get(opCtx)->catalogCache()->getShardedCollectionRoutingInfoWithRefresh(opCtx, nss)); const auto uuid = cm.getUUID(); std::set<ShardId> shardsIds; @@ -639,7 +643,6 @@ void ShardingCatalogManager::configureCollectionBalancing( bumpCollectionMinorVersionInTxn(opCtx, nss, txnNumber); }); - const auto executor = Grid::get(opCtx)->getExecutorPool()->getFixedExecutor(); sharding_util::tellShardsToRefreshCollection( opCtx, |