summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorPaolo Polato <paolo.polato@mongodb.com>2022-02-21 17:03:24 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-21 17:32:01 +0000
commit4cdd3f9439ba0eb8e6540465638d5cac3aca1fdf (patch)
tree1a097502b19a9ccde9377e13bdd8761d75e7c6bf /src/mongo/db
parentb80fabd0dfc93d154eb427f46c73b1acea857cbf (diff)
downloadmongo-4cdd3f9439ba0eb8e6540465638d5cac3aca1fdf.tar.gz
SERVER-63203 fix checkMetadataForSuccessfulSplitChunk()
Diffstat (limited to 'src/mongo/db')
-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;
}
}