summaryrefslogtreecommitdiff
path: root/src/mongo/s/sharding_initialization.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2020-11-15 03:35:08 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-11-16 15:53:59 +0000
commita2fb8664bfc09a7b970f5de8188b4478ff64fc23 (patch)
tree7eff805d3131bf971772570a564f78fd94a6ab82 /src/mongo/s/sharding_initialization.cpp
parentc87fcc64bead3fad53f63f434d4a2c14219e58bd (diff)
downloadmongo-a2fb8664bfc09a7b970f5de8188b4478ff64fc23.tar.gz
SERVER-52872 Remove StatusWith methods from ShardingCatalogClient
As a side-effect also removes some of the legacy "fromBSON" parsing from CollectionType in an effort to make it behave more IDL-like.
Diffstat (limited to 'src/mongo/s/sharding_initialization.cpp')
-rw-r--r--src/mongo/s/sharding_initialization.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/mongo/s/sharding_initialization.cpp b/src/mongo/s/sharding_initialization.cpp
index af0cb15f5ea..a721115577d 100644
--- a/src/mongo/s/sharding_initialization.cpp
+++ b/src/mongo/s/sharding_initialization.cpp
@@ -279,20 +279,14 @@ Status preCacheMongosRoutingInfo(OperationContext* opCtx) {
}
auto grid = Grid::get(opCtx);
+ auto catalogClient = grid->catalogClient();
+ auto catalogCache = grid->catalogCache();
+ auto allDbs = catalogClient->getAllDBs(opCtx, repl::ReadConcernLevel::kMajorityReadConcern);
- auto shardingCatalogClient = grid->catalogClient();
- auto result =
- shardingCatalogClient->getAllDBs(opCtx, repl::ReadConcernLevel::kMajorityReadConcern);
-
- if (!result.isOK()) {
- return result.getStatus();
- }
-
- auto cache = grid->catalogCache();
- for (auto& db : result.getValue().value) {
- for (auto& coll : shardingCatalogClient->getAllShardedCollectionsForDb(
+ for (auto& db : allDbs) {
+ for (auto& coll : catalogClient->getAllShardedCollectionsForDb(
opCtx, db.getName(), repl::ReadConcernLevel::kMajorityReadConcern)) {
- auto resp = cache->getShardedCollectionRoutingInfoWithRefresh(opCtx, coll);
+ auto resp = catalogCache->getShardedCollectionRoutingInfoWithRefresh(opCtx, coll);
if (!resp.isOK()) {
return resp.getStatus();
}