summaryrefslogtreecommitdiff
path: root/src/mongo/s/commands/cluster_split_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/commands/cluster_split_cmd.cpp')
-rw-r--r--src/mongo/s/commands/cluster_split_cmd.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mongo/s/commands/cluster_split_cmd.cpp b/src/mongo/s/commands/cluster_split_cmd.cpp
index 6bfabdb5b76..2b8cf4a8171 100644
--- a/src/mongo/s/commands/cluster_split_cmd.cpp
+++ b/src/mongo/s/commands/cluster_split_cmd.cpp
@@ -249,14 +249,16 @@ public:
// specified in the split command through the "middle" parameter, choose "middle" as the
// splitPoint. Otherwise use the splitVector command with 'force' to ask the shard for the
// middle of the chunk.
+ const auto placementVersion = cm.getVersion(chunk->getShardId());
const BSONObj splitPoint = !middle.isEmpty()
? middle
- : selectMedianKey(opCtx,
- chunk->getShardId(),
- nss,
- cm.getShardKeyPattern(),
- cm.getVersion(chunk->getShardId()),
- ChunkRange(chunk->getMin(), chunk->getMax()));
+ : selectMedianKey(
+ opCtx,
+ chunk->getShardId(),
+ nss,
+ cm.getShardKeyPattern(),
+ ShardVersion(placementVersion, CollectionIndexes(placementVersion, boost::none)),
+ ChunkRange(chunk->getMin(), chunk->getMax()));
LOGV2(22758,
"Splitting chunk {chunkRange} in {namespace} on shard {shardId} at key {splitPoint}",