diff options
Diffstat (limited to 'src/mongo/db/s/auto_split_vector_command.cpp')
-rw-r--r-- | src/mongo/db/s/auto_split_vector_command.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mongo/db/s/auto_split_vector_command.cpp b/src/mongo/db/s/auto_split_vector_command.cpp index df88204dc0b..1aac404e8f1 100644 --- a/src/mongo/db/s/auto_split_vector_command.cpp +++ b/src/mongo/db/s/auto_split_vector_command.cpp @@ -36,6 +36,9 @@ namespace mongo { namespace { +static constexpr int64_t kSmallestChunkSizeBytesSupported = 1024 * 1024; +static constexpr int64_t kBiggestChunkSizeBytesSupported = 1024 * 1024 * 1024; + class AutoSplitVectorCommand final : public TypedCommand<AutoSplitVectorCommand> { public: AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { @@ -63,6 +66,13 @@ public: const auto& req = request(); + uassert(ErrorCodes::ErrorCodes::InvalidOptions, + str::stream() << "maxChunksSizeBytes must lie within the range [" + << kSmallestChunkSizeBytesSupported / (1024 * 1024) << "MB, " + << kBiggestChunkSizeBytesSupported / (1024 * 1024) << "MB]", + req.getMaxChunkSizeBytes() >= kSmallestChunkSizeBytesSupported && + req.getMaxChunkSizeBytes() <= kBiggestChunkSizeBytesSupported); + auto splitKeys = autoSplitVector(opCtx, ns(), req.getKeyPattern(), |