summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Polato <paolo.polato@mongodb.com>2022-02-21 20:17:35 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-21 21:11:41 +0000
commitc6cf3ce83c7c9d30278cee43b2a7eb06ddd47816 (patch)
treeb1aa1dfd78cb68d05f2fcfca4796d58a4af9f443
parent59e5dbbc35d780fb85f9e1d8c3a0a3e36ff685c6 (diff)
downloadmongo-c6cf3ce83c7c9d30278cee43b2a7eb06ddd47816.tar.gz
SERVER-63203 fix checkMetadataForSuccessfulSplitChunk()
-rw-r--r--src/mongo/db/s/split_chunk.cpp6
1 files 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;
}
}