summaryrefslogtreecommitdiff
path: root/src/mongo/s/catalog
diff options
context:
space:
mode:
authorSimon Graetzer <simon.gratzer@mongodb.com>2021-07-30 11:41:40 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-07-30 12:09:37 +0000
commit66708080ab5db302558f7bd33293167d181f3858 (patch)
tree91dc9abafabbc7456b1db6d422087d2e04ba5bf2 /src/mongo/s/catalog
parenta05959f3e16b909dd76f7935b7fb529d02942dff (diff)
downloadmongo-66708080ab5db302558f7bd33293167d181f3858.tar.gz
SERVER-58270 Create configureCollectionAutoSplitter command
Diffstat (limited to 'src/mongo/s/catalog')
-rw-r--r--src/mongo/s/catalog/type_collection.cpp6
-rw-r--r--src/mongo/s/catalog/type_collection.h10
-rw-r--r--src/mongo/s/catalog/type_collection.idl10
3 files changed, 25 insertions, 1 deletions
diff --git a/src/mongo/s/catalog/type_collection.cpp b/src/mongo/s/catalog/type_collection.cpp
index c518a135aaa..349bda5a43a 100644
--- a/src/mongo/s/catalog/type_collection.cpp
+++ b/src/mongo/s/catalog/type_collection.cpp
@@ -36,6 +36,7 @@
#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/bson/simple_bsonobj_comparator.h"
#include "mongo/bson/util/bson_extract.h"
+#include "mongo/s/balancer_configuration.h"
#include "mongo/util/assert_util.h"
namespace mongo {
@@ -93,4 +94,9 @@ void CollectionType::setDefaultCollation(const BSONObj& defaultCollation) {
setPre50CompatibleDefaultCollation(defaultCollation);
}
+void CollectionType::setMaxChunkSizeBytes(int64_t value) {
+ uassert(ErrorCodes::BadValue, "Default chunk size is out of range", value > 0);
+ CollectionTypeBase::setMaxChunkSizeBytes(value);
+}
+
} // namespace mongo
diff --git a/src/mongo/s/catalog/type_collection.h b/src/mongo/s/catalog/type_collection.h
index a5710d08f76..ffdc31a4a64 100644
--- a/src/mongo/s/catalog/type_collection.h
+++ b/src/mongo/s/catalog/type_collection.h
@@ -84,6 +84,9 @@ public:
static constexpr auto kKeyPatternFieldName = kPre50CompatibleKeyPatternFieldName;
static constexpr auto kUuidFieldName = kPre50CompatibleUuidFieldName;
static constexpr auto kAllowMigrationsFieldName = kPre50CompatibleAllowMigrationsFieldName;
+
+ using CollectionTypeBase::kMaxChunkSizeBytesFieldName;
+ using CollectionTypeBase::kNoAutoSplitFieldName;
using CollectionTypeBase::kNssFieldName;
using CollectionTypeBase::kReshardingFieldsFieldName;
using CollectionTypeBase::kTimeseriesFieldsFieldName;
@@ -92,6 +95,7 @@ public:
using CollectionTypeBase::kUpdatedAtFieldName;
// Make getters and setters accessible.
+ using CollectionTypeBase::getMaxChunkSizeBytes;
using CollectionTypeBase::getNss;
using CollectionTypeBase::getReshardingFields;
using CollectionTypeBase::getTimeseriesFields;
@@ -147,6 +151,12 @@ public:
}
void setDefaultCollation(const BSONObj& defaultCollation);
+ void setMaxChunkSizeBytes(int64_t value);
+
+ bool getAllowAutoSplit() const {
+ return !getNoAutoSplit();
+ }
+
bool getAllowBalance() const {
return !getNoBalance();
}
diff --git a/src/mongo/s/catalog/type_collection.idl b/src/mongo/s/catalog/type_collection.idl
index 5917c2faad5..3f91bbc0bee 100644
--- a/src/mongo/s/catalog/type_collection.idl
+++ b/src/mongo/s/catalog/type_collection.idl
@@ -117,6 +117,14 @@ structs:
type: bool
description: "Uniqueness of the sharding key."
default: false
+ maxChunkSizeBytes:
+ type: safeInt64
+ description: "Max chunk size in bytes."
+ optional: true
+ noAutoSplit:
+ type: bool
+ description: "Specifies whether the auto-splitter should be running or not for this collection."
+ default: false
noBalance:
type: bool
description: "Consulted by the Balancer only and indicates whether this collection
@@ -144,4 +152,4 @@ structs:
type: TypeCollectionTimeseriesFields
description: "Time-series collection fields. Only set when this is a time-series
buckets collection."
- optional: true
+ optional: true \ No newline at end of file