summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/config/initial_split_policy.h
diff options
context:
space:
mode:
authorPierlauro Sciarelli <pierlauro.sciarelli@mongodb.com>2022-05-25 19:47:35 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-05-25 20:24:21 +0000
commit1646cf1bdfb3fcac4b1bed1960a747f44598e74a (patch)
tree0bcae94994f1c2027cd79a7eefa5a8f26a2fbcc8 /src/mongo/db/s/config/initial_split_policy.h
parent859e975fa5d59d673b8fe5c4ef4dc92647ee2138 (diff)
downloadmongo-1646cf1bdfb3fcac4b1bed1960a747f44598e74a.tar.gz
SERVER-66208 Remove chunk creation for shard collection with existing data
Co-authored-by: Kaloian Manassiev <kaloian.manassiev@mongodb.com>
Diffstat (limited to 'src/mongo/db/s/config/initial_split_policy.h')
-rw-r--r--src/mongo/db/s/config/initial_split_policy.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mongo/db/s/config/initial_split_policy.h b/src/mongo/db/s/config/initial_split_policy.h
index ced8d519a13..ed731ddaea0 100644
--- a/src/mongo/db/s/config/initial_split_policy.h
+++ b/src/mongo/db/s/config/initial_split_policy.h
@@ -53,6 +53,11 @@ public:
/**
* Returns the optimization strategy for building initial chunks based on the input parameters
* and the collection state.
+ *
+ * The 'useAutoSplitter' flag indicates to the initial split strategy selected that in case the
+ * collection contains data, it should use the auto splitter to chop that data into chunks
+ * respective to the configured chunk size. If set to false, the policy will create as large of
+ * chunks as possible.
*/
static std::unique_ptr<InitialSplitPolicy> calculateOptimizationStrategy(
OperationContext* opCtx,
@@ -62,7 +67,8 @@ public:
const boost::optional<std::vector<BSONObj>>& initialSplitPoints,
const std::vector<TagsType>& tags,
size_t numShards,
- bool collectionIsEmpty);
+ bool collectionIsEmpty,
+ bool useAutoSplitter = true /* Controlled by FCV, see the comment */);
virtual ~InitialSplitPolicy() {}
@@ -140,7 +146,7 @@ public:
* Split point building strategy to be used when no optimizations are available. We send a
* splitVector command to the primary shard in order to calculate the appropriate split points.
*/
-class UnoptimizedSplitPolicy : public InitialSplitPolicy {
+class AutoSplitInChunksOnPrimaryPolicy : public InitialSplitPolicy {
public:
ShardCollectionConfig createFirstChunks(OperationContext* opCtx,
const ShardKeyPattern& shardKeyPattern,