summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/create_collection_coordinator.cpp
diff options
context:
space:
mode:
authorPaolo Polato <paolo.polato@mongodb.com>2022-02-10 13:41:13 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-10 14:15:25 +0000
commitd018b7e964dafa5085152af03916bde0ac74f947 (patch)
tree5111f6c4a94ecdce8785d6d3bc8e81fc582234cc /src/mongo/db/s/create_collection_coordinator.cpp
parent9b2fe8666c8a633ed141b86676116094d2a468cb (diff)
downloadmongo-d018b7e964dafa5085152af03916bde0ac74f947.tar.gz
SERVER-63203 Do not fail chunk split if more than 8192 points are requested
Diffstat (limited to 'src/mongo/db/s/create_collection_coordinator.cpp')
-rw-r--r--src/mongo/db/s/create_collection_coordinator.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/db/s/create_collection_coordinator.cpp b/src/mongo/db/s/create_collection_coordinator.cpp
index b2edc047738..e2f40c66c72 100644
--- a/src/mongo/db/s/create_collection_coordinator.cpp
+++ b/src/mongo/db/s/create_collection_coordinator.cpp
@@ -645,18 +645,18 @@ void CreateCollectionCoordinator::_checkCommandArguments(OperationContext* opCtx
if (_doc.getNumInitialChunks()) {
// Ensure numInitialChunks is within valid bounds.
- // Cannot have more than 8192 initial chunks per shard. Setting a maximum of 1,000,000
- // chunks in total to limit the amount of memory this command consumes so there is less
- // danger of an OOM error.
+ // Cannot have more than kMaxSplitPoints initial chunks per shard. Setting a maximum of
+ // 1,000,000 chunks in total to limit the amount of memory this command consumes so there is
+ // less danger of an OOM error.
const int maxNumInitialChunksForShards =
- Grid::get(opCtx)->shardRegistry()->getNumShardsNoReload() * 8192;
+ Grid::get(opCtx)->shardRegistry()->getNumShardsNoReload() * shardutil::kMaxSplitPoints;
const int maxNumInitialChunksTotal = 1000 * 1000; // Arbitrary limit to memory consumption
int numChunks = _doc.getNumInitialChunks().value();
uassert(ErrorCodes::InvalidOptions,
str::stream() << "numInitialChunks cannot be more than either: "
- << maxNumInitialChunksForShards << ", 8192 * number of shards; or "
- << maxNumInitialChunksTotal,
+ << maxNumInitialChunksForShards << ", " << shardutil::kMaxSplitPoints
+ << " * number of shards; or " << maxNumInitialChunksTotal,
numChunks >= 0 && numChunks <= maxNumInitialChunksForShards &&
numChunks <= maxNumInitialChunksTotal);
}