diff options
| author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2020-11-15 03:35:08 -0500 |
|---|---|---|
| committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-11-16 15:53:59 +0000 |
| commit | a2fb8664bfc09a7b970f5de8188b4478ff64fc23 (patch) | |
| tree | 7eff805d3131bf971772570a564f78fd94a6ab82 /src/mongo/s/sharding_initialization.cpp | |
| parent | c87fcc64bead3fad53f63f434d4a2c14219e58bd (diff) | |
| download | mongo-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.cpp | 18 |
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(); } |
