From c6cf3ce83c7c9d30278cee43b2a7eb06ddd47816 Mon Sep 17 00:00:00 2001 From: Paolo Polato Date: Mon, 21 Feb 2022 20:17:35 +0000 Subject: SERVER-63203 fix checkMetadataForSuccessfulSplitChunk() --- src/mongo/db/s/split_chunk.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mongo/db/s/split_chunk.cpp b/src/mongo/db/s/split_chunk.cpp index 9e03e1cae96..651dc68f04a 100644 --- a/src/mongo/db/s/split_chunk.cpp +++ b/src/mongo/db/s/split_chunk.cpp @@ -109,9 +109,11 @@ bool checkMetadataForSuccessfulSplitChunk(OperationContext* opCtx, ChunkType nextChunk; for (auto it = splitPoints.begin(); it != splitPoints.end(); ++it) { // Check that all new chunks fit the new chunk boundaries - const auto& currentChunkMinKey = it == splitPoints.begin() ? chunkRange.getMin() : *it; + const auto& currentChunkMinKey = + it == splitPoints.begin() ? chunkRange.getMin() : *std::prev(it); + const auto& currentChunkMaxKey = *it; if (!metadataAfterSplit->getNextChunk(currentChunkMinKey, &nextChunk) || - nextChunk.getMax().woCompare(*it)) { + nextChunk.getMax().woCompare(currentChunkMaxKey)) { return false; } } -- cgit v1.2.1