summaryrefslogtreecommitdiff
path: root/src/mongo/s/balancer_policy.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-04-05 17:21:27 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-04-06 12:11:15 -0400
commit4ebbc778d02fa6a68eae0b920f068ac52c988a4d (patch)
tree214524cd87d0c4c9d55b2775cab75dd6c9d1f506 /src/mongo/s/balancer_policy.cpp
parent01993b8da5f02f02fd5bbb361b9a52382be0af0f (diff)
downloadmongo-4ebbc778d02fa6a68eae0b920f068ac52c988a4d.tar.gz
SERVER-23550 Cleanup balancer methods to use StatusWith
Diffstat (limited to 'src/mongo/s/balancer_policy.cpp')
-rw-r--r--src/mongo/s/balancer_policy.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mongo/s/balancer_policy.cpp b/src/mongo/s/balancer_policy.cpp
index f8ff4c49f65..e4ac76a0db9 100644
--- a/src/mongo/s/balancer_policy.cpp
+++ b/src/mongo/s/balancer_policy.cpp
@@ -271,13 +271,15 @@ void DistributionStatus::dump() const {
}
}
-Status DistributionStatus::populateShardInfoMap(OperationContext* txn, ShardInfoMap* shardInfo) {
+StatusWith<ShardInfoMap> DistributionStatus::populateShardInfoMap(OperationContext* txn) {
try {
auto shardsStatus = grid.catalogManager(txn)->getAllShards(txn);
if (!shardsStatus.isOK()) {
return shardsStatus.getStatus();
}
- vector<ShardType> shards = std::move(shardsStatus.getValue().value);
+ const vector<ShardType> shards(std::move(shardsStatus.getValue().value));
+
+ ShardInfoMap shardInfo;
for (const ShardType& shardData : shards) {
std::set<std::string> dummy;
@@ -298,13 +300,13 @@ Status DistributionStatus::populateShardInfoMap(OperationContext* txn, ShardInfo
newShardEntry.addTag(shardTag);
}
- shardInfo->insert(make_pair(shardData.getName(), newShardEntry));
+ shardInfo.insert(make_pair(shardData.getName(), newShardEntry));
}
+
+ return std::move(shardInfo);
} catch (const DBException& ex) {
return ex.toStatus();
}
-
- return Status::OK();
}
void DistributionStatus::populateShardToChunksMap(const ShardInfoMap& allShards,