diff options
-rw-r--r-- | jstests/sharding/libs/mongos_api_params_util.js | 2 | ||||
-rw-r--r-- | src/mongo/db/s/auto_split_vector_command.cpp | 7 | ||||
-rw-r--r-- | src/mongo/db/s/split_vector_command.cpp | 4 |
3 files changed, 10 insertions, 3 deletions
diff --git a/jstests/sharding/libs/mongos_api_params_util.js b/jstests/sharding/libs/mongos_api_params_util.js index 97e94ab2081..914f6b70462 100644 --- a/jstests/sharding/libs/mongos_api_params_util.js +++ b/jstests/sharding/libs/mongos_api_params_util.js @@ -1263,7 +1263,7 @@ let MongosAPIParametersUtil = (function() { keyPattern: {_id: 1}, min: {_id: 0}, max: {_id: MaxKey}, - maxChunkSizeBytes: 1024 + maxChunkSizeBytes: 1024 * 1024 }) } }, diff --git a/src/mongo/db/s/auto_split_vector_command.cpp b/src/mongo/db/s/auto_split_vector_command.cpp index 2b0657cc3ce..1748491cac6 100644 --- a/src/mongo/db/s/auto_split_vector_command.cpp +++ b/src/mongo/db/s/auto_split_vector_command.cpp @@ -39,6 +39,8 @@ namespace mongo { namespace { +static constexpr int64_t kSmallestChunkSizeSupported = 1024 * 1024; + class AutoSplitVectorCommand final : public TypedCommand<AutoSplitVectorCommand> { public: bool skipApiVersionCheck() const override { @@ -72,6 +74,11 @@ public: const auto& req = request(); + uassert(ErrorCodes::ErrorCodes::InvalidOptions, + str::stream() << "maxChunksSizeBytes cannot be smaller than " + << kSmallestChunkSizeSupported, + req.getMaxChunkSizeBytes() >= kSmallestChunkSizeSupported); + auto splitKeys = autoSplitVector(opCtx, ns(), req.getKeyPattern(), diff --git a/src/mongo/db/s/split_vector_command.cpp b/src/mongo/db/s/split_vector_command.cpp index 9754207a8bd..b485c08361c 100644 --- a/src/mongo/db/s/split_vector_command.cpp +++ b/src/mongo/db/s/split_vector_command.cpp @@ -146,8 +146,8 @@ public: } uassert(ErrorCodes::InvalidOptions, - "The specified max chunk size must be greater than 0", - ret == boost::none || *ret > 0); + "The specified max chunk size must be at least 1MB", + ret == boost::none || *ret >= 1024 * 1024); return ret; }(); |