diff options
-rw-r--r-- | src/mongo/db/s/balancer/balancer.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/s/shardsvr_move_range_command.cpp | 7 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_move_range_cmd.cpp | 3 | ||||
-rw-r--r-- | src/mongo/s/request_types/move_range_request.idl | 1 |
4 files changed, 11 insertions, 3 deletions
diff --git a/src/mongo/db/s/balancer/balancer.cpp b/src/mongo/db/s/balancer/balancer.cpp index 51901478f8e..b4466c22f2c 100644 --- a/src/mongo/db/s/balancer/balancer.cpp +++ b/src/mongo/db/s/balancer/balancer.cpp @@ -394,7 +394,8 @@ Status Balancer::moveRange(OperationContext* opCtx, const auto cm = uassertStatusOK( Grid::get(opCtx)->catalogCache()->getShardedCollectionRoutingInfoWithRefresh(opCtx, nss)); - return cm.findIntersectingChunkWithSimpleCollation(request.getMin()); + // TODO SERVER-64926 do not assume min always present + return cm.findIntersectingChunkWithSimpleCollation(*request.getMin()); }(); if (chunk.getShardId() == request.getToShard()) { diff --git a/src/mongo/db/s/shardsvr_move_range_command.cpp b/src/mongo/db/s/shardsvr_move_range_command.cpp index dc3e3887d1d..ad92264d0cd 100644 --- a/src/mongo/db/s/shardsvr_move_range_command.cpp +++ b/src/mongo/db/s/shardsvr_move_range_command.cpp @@ -92,7 +92,8 @@ public: BSONObjBuilder moveChunkReqBuilder(originalReq.toBSON({})); moveChunkReqBuilder.append(WriteConcernOptions::kWriteConcernField, WC.toBSON()); - const auto& min = request().getMin(); + // TODO SERVER-64926 do not assume min always present + const auto& min = *request().getMin(); // TODO SERVER-64817 compute missing bound of `moveRange` within MigrationSourceManager if (!originalReq.getMax().is_initialized()) { @@ -224,10 +225,12 @@ public: BSONObj computeMaxBound(OperationContext* opCtx, const Chunk& owningChunk, const ShardKeyPattern& skPattern) { + // TODO SERVER-64926 do not assume min always present + const auto& min = *request().getMin(); auto [splitKeys, _] = autoSplitVector(opCtx, ns(), skPattern.toBSON(), - request().getMin(), + min, owningChunk.getMax(), *request().getMaxChunkSizeBytes(), 1); diff --git a/src/mongo/s/commands/cluster_move_range_cmd.cpp b/src/mongo/s/commands/cluster_move_range_cmd.cpp index 43b59cc3610..bb53559394b 100644 --- a/src/mongo/s/commands/cluster_move_range_cmd.cpp +++ b/src/mongo/s/commands/cluster_move_range_cmd.cpp @@ -63,6 +63,9 @@ public: const auto nss = ns(); const auto& req = request(); + // TODO SERVER-64926 do not assume min always present + uassert(ErrorCodes::InvalidOptions, "Missing required parameter 'min'", req.getMin()); + ConfigsvrMoveRange configsvrRequest(nss); configsvrRequest.setDbName(NamespaceString::kAdminDb); configsvrRequest.setMoveRangeRequest(req.getMoveRangeRequest()); diff --git a/src/mongo/s/request_types/move_range_request.idl b/src/mongo/s/request_types/move_range_request.idl index 69fe2c3bc1c..bb9edfbc240 100644 --- a/src/mongo/s/request_types/move_range_request.idl +++ b/src/mongo/s/request_types/move_range_request.idl @@ -57,6 +57,7 @@ structs: min: type: object description: "The min key of the range to move" + optional: true max: type: object description: "The max key of the range to move" |