From 9eccc4ff68b55b32d5eb9232b18a5a073effe41c Mon Sep 17 00:00:00 2001 From: Simon Graetzer Date: Wed, 22 Sep 2021 13:21:39 +0000 Subject: SERVER-60074 Add feature flag for configureCollectionAutoSplitter command --- src/mongo/db/s/config/configsvr_configure_collection_auto_split.cpp | 5 +++++ src/mongo/s/catalog/type_collection.h | 2 +- src/mongo/s/catalog/type_collection.idl | 2 +- src/mongo/s/request_types/configure_collection_auto_split.idl | 6 ++++++ 4 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src/mongo') diff --git a/src/mongo/db/s/config/configsvr_configure_collection_auto_split.cpp b/src/mongo/db/s/config/configsvr_configure_collection_auto_split.cpp index 6286ae55baf..a27a84b141d 100644 --- a/src/mongo/db/s/config/configsvr_configure_collection_auto_split.cpp +++ b/src/mongo/db/s/config/configsvr_configure_collection_auto_split.cpp @@ -64,6 +64,11 @@ public: str::stream() << Request::kCommandName << " can only be run on config servers", serverGlobalParams.clusterRole == ClusterRole::ConfigServer); + uassert(8423309, + "_configsvrConfigureAutoSplit command not supported", + mongo::feature_flags::gShardingPerCollectionAutoSplitter.isEnabled( + serverGlobalParams.featureCompatibility)); + const NamespaceString& nss = ns(); uassert(ErrorCodes::InvalidNamespace, diff --git a/src/mongo/s/catalog/type_collection.h b/src/mongo/s/catalog/type_collection.h index a903da4d224..fb032a94f72 100644 --- a/src/mongo/s/catalog/type_collection.h +++ b/src/mongo/s/catalog/type_collection.h @@ -145,7 +145,7 @@ public: void setMaxChunkSizeBytes(int64_t value); bool getAllowAutoSplit() const { - return !getNoAutoSplit(); + return !getNoAutoSplit().get_value_or(false); } bool getAllowBalance() const { diff --git a/src/mongo/s/catalog/type_collection.idl b/src/mongo/s/catalog/type_collection.idl index 10612997ec8..acff4f93d88 100644 --- a/src/mongo/s/catalog/type_collection.idl +++ b/src/mongo/s/catalog/type_collection.idl @@ -113,7 +113,7 @@ structs: noAutoSplit: type: bool description: "Specifies whether the auto-splitter should be running or not for this collection." - default: false + optional: true noBalance: type: bool description: "Consulted by the Balancer only and indicates whether this collection diff --git a/src/mongo/s/request_types/configure_collection_auto_split.idl b/src/mongo/s/request_types/configure_collection_auto_split.idl index 0a3121d8256..f4ccc578ff0 100644 --- a/src/mongo/s/request_types/configure_collection_auto_split.idl +++ b/src/mongo/s/request_types/configure_collection_auto_split.idl @@ -34,6 +34,12 @@ global: imports: - "mongo/idl/basic_types.idl" +feature_flags: + featureFlagPerCollectionAutoSplitter: + description: "Add capability to configure per collection auto-splitter settings." + cpp_varname: feature_flags::gShardingPerCollectionAutoSplitter + default: false + structs: configure_auto_split_params: description: "Parameters for configureCollectionAutoSplitter command" -- cgit v1.2.1