diff options
author | Kevin Pulo <kevin.pulo@mongodb.com> | 2017-11-29 03:54:49 +0000 |
---|---|---|
committer | Kevin Pulo <kevin.pulo@mongodb.com> | 2017-12-18 05:47:06 +0000 |
commit | 8a9090c4c59a840639f37c509fd0f2c6af252117 (patch) | |
tree | bc129d2c254438a6a971eb246fa4b6246310096d /src/mongo/db/s/balancer | |
parent | 8467708af7fa83f8827362b80f56dab4aad30a41 (diff) | |
download | mongo-8a9090c4c59a840639f37c509fd0f2c6af252117.tar.gz |
SERVER-18138 catalog manager listing methods now return vectors
Diffstat (limited to 'src/mongo/db/s/balancer')
-rw-r--r-- | src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp b/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp index 3654fcdcd8d..2bf7db8dc9a 100644 --- a/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp +++ b/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp @@ -83,15 +83,15 @@ StatusWith<DistributionStatus> createCollectionDistributionStatus( shardToChunksMap[chunkEntry->getShardId()].push_back(chunk); } - vector<TagsType> collectionTags; - Status tagsStatus = Grid::get(opCtx)->catalogClient()->getTagsForCollection( - opCtx, chunkMgr->getns(), &collectionTags); - if (!tagsStatus.isOK()) { - return {tagsStatus.code(), + const auto swCollectionTags = + Grid::get(opCtx)->catalogClient()->getTagsForCollection(opCtx, chunkMgr->getns()); + if (!swCollectionTags.isOK()) { + return {swCollectionTags.getStatus().code(), str::stream() << "Unable to load tags for collection " << chunkMgr->getns() << " due to " - << tagsStatus.toString()}; + << swCollectionTags.getStatus().toString()}; } + const auto& collectionTags = swCollectionTags.getValue(); DistributionStatus distribution(NamespaceString(chunkMgr->getns()), std::move(shardToChunksMap)); @@ -191,14 +191,14 @@ StatusWith<SplitInfoVector> BalancerChunkSelectionPolicyImpl::selectChunksToSpli const auto shardStats = std::move(shardStatsStatus.getValue()); - vector<CollectionType> collections; - - Status collsStatus = - Grid::get(opCtx)->catalogClient()->getCollections(opCtx, nullptr, &collections, nullptr); - if (!collsStatus.isOK()) { - return collsStatus; + const auto swCollections = + Grid::get(opCtx)->catalogClient()->getCollections(opCtx, nullptr, nullptr); + if (!swCollections.isOK()) { + return swCollections.getStatus(); } + const auto& collections = swCollections.getValue(); + if (collections.empty()) { return SplitInfoVector{}; } @@ -243,14 +243,15 @@ StatusWith<MigrateInfoVector> BalancerChunkSelectionPolicyImpl::selectChunksToMo return MigrateInfoVector{}; } - vector<CollectionType> collections; - Status collsStatus = - Grid::get(opCtx)->catalogClient()->getCollections(opCtx, nullptr, &collections, nullptr); - if (!collsStatus.isOK()) { - return collsStatus; + const auto swCollections = + Grid::get(opCtx)->catalogClient()->getCollections(opCtx, nullptr, nullptr); + if (!swCollections.isOK()) { + return swCollections.getStatus(); } + const auto& collections = swCollections.getValue(); + if (collections.empty()) { return MigrateInfoVector{}; } |