summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp
diff options
context:
space:
mode:
authorMatthew Saltz <matthew.saltz@mongodb.com>2018-03-23 15:05:15 -0400
committerMatthew Saltz <matthew.saltz@mongodb.com>2018-03-29 13:28:11 -0400
commit6306b96749d4a547a1fa023eb1a0085b37e75c07 (patch)
treedc1319cd6b4782d70b9d084a524ada7b31998a96 /src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp
parent50e1e0be8d2eeccf866a3b249f63bdfdf91e3698 (diff)
downloadmongo-6306b96749d4a547a1fa023eb1a0085b37e75c07.tar.gz
SERVER-33797: Reload ShardRegistry on shard collection command
Diffstat (limited to 'src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp')
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp b/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp
index 34263b7cb31..2ee60c2011d 100644
--- a/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp
@@ -887,14 +887,9 @@ StatusWith<ShardId> ShardingCatalogManager::_selectShardForNewDatabase(
OperationContext* opCtx, ShardRegistry* shardRegistry) {
std::vector<ShardId> allShardIds;
- shardRegistry->getAllShardIds(&allShardIds);
+ shardRegistry->getAllShardIds(opCtx, &allShardIds);
if (allShardIds.empty()) {
- shardRegistry->reload(opCtx);
- shardRegistry->getAllShardIds(&allShardIds);
-
- if (allShardIds.empty()) {
- return Status(ErrorCodes::ShardNotFound, "No shards found");
- }
+ return Status(ErrorCodes::ShardNotFound, "No shards found");
}
ShardId candidateShardId = allShardIds[0];