diff options
author | Pierlauro Sciarelli <pierlauro.sciarelli@mongodb.com> | 2022-03-30 07:18:30 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-03-30 07:47:45 +0000 |
commit | 9a41c7c67f7bfb9ca68858a37b7863e32796cc09 (patch) | |
tree | ad697cbc7ea40a54b6009d2123f168da5b8f794f | |
parent | 92ec20cd6fc72f85d68a8ecb5682d1a5a7a1500b (diff) | |
download | mongo-9a41c7c67f7bfb9ca68858a37b7863e32796cc09.tar.gz |
SERVER-65021 Avoid creating small chunks if `autoSplitVector` called with a limit > 1
-rw-r--r-- | src/mongo/db/s/auto_split_vector.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/db/s/auto_split_vector.cpp b/src/mongo/db/s/auto_split_vector.cpp index bd094206979..8be8c5dde8b 100644 --- a/src/mongo/db/s/auto_split_vector.cpp +++ b/src/mongo/db/s/auto_split_vector.cpp @@ -258,9 +258,9 @@ std::pair<std::vector<BSONObj>, bool> autoSplitVector(OperationContext* opCtx, lastSplitPoint = splitKeys.back(); numScannedKeys = 0; - if (limit && splitKeys.size() == static_cast<size_t>(std::max(2, *limit))) { - // If the user has specified a limit, calculate the first 2 split points (avoid - // creating small chunks) + if (limit && splitKeys.size() == static_cast<size_t>(*limit + 1)) { + // If the user has specified a limit, calculate the first `limit + 1` split + // points (avoid creating small chunks) break; } |