diff options
author | Pierlauro Sciarelli <pierlauro.sciarelli@mongodb.com> | 2021-10-27 13:55:13 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-10-27 14:23:55 +0000 |
commit | 0ff1013b7da4f6e2b61cc6eab6f846d05bc80206 (patch) | |
tree | c629f7d868af07f093696fc918917ec69ad70cd7 /src/mongo/db/s/chunk_splitter.cpp | |
parent | 5c466f92034e113ac3006b956492a7b51c0a6644 (diff) | |
download | mongo-0ff1013b7da4f6e2b61cc6eab6f846d05bc80206.tar.gz |
SERVER-60654 Backport the autoSplitVector logic to v4.0
Diffstat (limited to 'src/mongo/db/s/chunk_splitter.cpp')
-rw-r--r-- | src/mongo/db/s/chunk_splitter.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/mongo/db/s/chunk_splitter.cpp b/src/mongo/db/s/chunk_splitter.cpp index bd4c8878544..73eb4266aa5 100644 --- a/src/mongo/db/s/chunk_splitter.cpp +++ b/src/mongo/db/s/chunk_splitter.cpp @@ -39,9 +39,9 @@ #include "mongo/db/client.h" #include "mongo/db/dbdirectclient.h" #include "mongo/db/namespace_string.h" +#include "mongo/db/s/auto_split_vector.h" #include "mongo/db/s/sharding_state.h" #include "mongo/db/s/split_chunk.h" -#include "mongo/db/s/split_vector.h" #include "mongo/db/service_context.h" #include "mongo/s/balancer_configuration.h" #include "mongo/s/catalog/type_chunk.h" @@ -320,18 +320,15 @@ void ChunkSplitter::_runAutosplit(const NamespaceString& nss, << " dataWritten since last check: " << dataWritten << " maxChunkSizeBytes: " << maxChunkSizeBytes; - auto splitPoints = uassertStatusOK(splitVector(opCtx.get(), - nss, - cm->getShardKeyPattern().toBSON(), - chunk.getMin(), - chunk.getMax(), - false, - boost::none, - boost::none, - boost::none, - maxChunkSizeBytes)); - - if (splitPoints.size() <= 1) { + const auto& shardKeyPattern = cm->getShardKeyPattern(); + auto splitPoints = autoSplitVector(opCtx.get(), + nss, + shardKeyPattern.toBSON(), + chunk.getMin(), + chunk.getMax(), + maxChunkSizeBytes); + + if (splitPoints.empty()) { // No split points means there isn't enough data to split on; 1 split point means we // have between half the chunk size to full chunk size so there is no need to split yet return; |