summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/balancer
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2017-12-27 13:11:00 -0500
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2017-12-28 21:46:54 -0500
commit10e3ce2d905ca3afc1e5949da2daa3353740171a (patch)
tree0f532002ff244bac41b652daf6c2c1e783a3a25e /src/mongo/db/s/balancer
parent800f84351f3f4f07aadf84b08be68f6be44fcfca (diff)
downloadmongo-10e3ce2d905ca3afc1e5949da2daa3353740171a.tar.gz
SERVER-28992 Get rid of unused code from the write commands tests
Diffstat (limited to 'src/mongo/db/s/balancer')
-rw-r--r--src/mongo/db/s/balancer/balancer.cpp2
-rw-r--r--src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp12
-rw-r--r--src/mongo/db/s/balancer/migration_manager.cpp7
3 files changed, 8 insertions, 13 deletions
diff --git a/src/mongo/db/s/balancer/balancer.cpp b/src/mongo/db/s/balancer/balancer.cpp
index 036cb89cb75..99fed7b8737 100644
--- a/src/mongo/db/s/balancer/balancer.cpp
+++ b/src/mongo/db/s/balancer/balancer.cpp
@@ -623,7 +623,7 @@ void Balancer::_splitOrMarkJumbo(OperationContext* opCtx,
Grid::get(opCtx)->catalogCache()->getShardedCollectionRoutingInfoWithRefresh(opCtx, nss));
const auto cm = routingInfo.cm().get();
- auto chunk = cm->findIntersectingChunkWithSimpleCollation(minKey);
+ const auto chunk = cm->findIntersectingChunkWithSimpleCollation(minKey);
try {
const auto splitPoints = uassertStatusOK(shardutil::selectChunkSplitPoints(
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 2bf7db8dc9a..1ebe571a210 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
@@ -385,8 +385,7 @@ StatusWith<SplitInfoVector> BalancerChunkSelectionPolicyImpl::_getSplitCandidate
for (const auto& tagRangeEntry : distribution.tagRanges()) {
const auto& tagRange = tagRangeEntry.second;
- shared_ptr<Chunk> chunkAtZoneMin =
- cm->findIntersectingChunkWithSimpleCollation(tagRange.min);
+ const auto chunkAtZoneMin = cm->findIntersectingChunkWithSimpleCollation(tagRange.min);
invariant(chunkAtZoneMin->getMax().woCompare(tagRange.min) > 0);
if (chunkAtZoneMin->getMin().woCompare(tagRange.min)) {
@@ -397,8 +396,7 @@ StatusWith<SplitInfoVector> BalancerChunkSelectionPolicyImpl::_getSplitCandidate
if (!tagRange.max.woCompare(shardKeyPattern.globalMax()))
continue;
- shared_ptr<Chunk> chunkAtZoneMax =
- cm->findIntersectingChunkWithSimpleCollation(tagRange.max);
+ const auto chunkAtZoneMax = cm->findIntersectingChunkWithSimpleCollation(tagRange.max);
// We need to check that both the chunk's minKey does not match the zone's max and also that
// the max is not equal, which would only happen in the case of the zone ending in MaxKey.
@@ -436,8 +434,7 @@ StatusWith<MigrateInfoVector> BalancerChunkSelectionPolicyImpl::_getMigrateCandi
for (const auto& tagRangeEntry : distribution.tagRanges()) {
const auto& tagRange = tagRangeEntry.second;
- shared_ptr<Chunk> chunkAtZoneMin =
- cm->findIntersectingChunkWithSimpleCollation(tagRange.min);
+ const auto chunkAtZoneMin = cm->findIntersectingChunkWithSimpleCollation(tagRange.min);
if (chunkAtZoneMin->getMin().woCompare(tagRange.min)) {
return {ErrorCodes::IllegalOperation,
@@ -455,8 +452,7 @@ StatusWith<MigrateInfoVector> BalancerChunkSelectionPolicyImpl::_getMigrateCandi
if (!tagRange.max.woCompare(shardKeyPattern.globalMax()))
continue;
- shared_ptr<Chunk> chunkAtZoneMax =
- cm->findIntersectingChunkWithSimpleCollation(tagRange.max);
+ const auto chunkAtZoneMax = cm->findIntersectingChunkWithSimpleCollation(tagRange.max);
// We need to check that both the chunk's minKey does not match the zone's max and also that
// the max is not equal, which would only happen in the case of the zone ending in MaxKey.
diff --git a/src/mongo/db/s/balancer/migration_manager.cpp b/src/mongo/db/s/balancer/migration_manager.cpp
index cd2d1baa30e..91af176fa8b 100644
--- a/src/mongo/db/s/balancer/migration_manager.cpp
+++ b/src/mongo/db/s/balancer/migration_manager.cpp
@@ -190,8 +190,8 @@ Status MigrationManager::executeManualMigration(
auto& routingInfo = routingInfoStatus.getValue();
- auto chunk = routingInfo.cm()->findIntersectingChunkWithSimpleCollation(migrateInfo.minKey);
- invariant(chunk);
+ const auto chunk =
+ routingInfo.cm()->findIntersectingChunkWithSimpleCollation(migrateInfo.minKey);
Status commandStatus = _processRemoteCommandResponse(
remoteCommandResponse, &statusWithScopedMigrationRequest.getValue());
@@ -336,9 +336,8 @@ void MigrationManager::finishRecovery(OperationContext* opCtx,
auto waitForDelete = migrationType.getWaitForDelete();
migrateInfos.pop_front();
- auto chunk =
+ const auto chunk =
routingInfo.cm()->findIntersectingChunkWithSimpleCollation(migrationInfo.minKey);
- invariant(chunk);
if (chunk->getShardId() != migrationInfo.from) {
// Chunk is no longer on the source shard specified by this migration. Erase the