summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
authorJamie Heppenstall <jamie.heppenstall@mongodb.com>2019-08-06 15:52:35 -0400
committerJamie Heppenstall <jamie.heppenstall@mongodb.com>2019-08-08 11:47:13 -0400
commit72520f60c55cf5a78ac3f1a25166ac7bba2c6a3e (patch)
treef63274b141cc837faf33c0535fb34c835cf304ac /src/mongo/s
parent91fe7e5d9f9a221d1e2edc7cca32925bd6675750 (diff)
downloadmongo-72520f60c55cf5a78ac3f1a25166ac7bba2c6a3e.tar.gz
SERVER-42368 Remove max shard key size limit of 512 bytes
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/commands/cluster_split_cmd.cpp4
-rw-r--r--src/mongo/s/shard_key_pattern.cpp12
-rw-r--r--src/mongo/s/shard_key_pattern.h8
-rw-r--r--src/mongo/s/write_ops/chunk_manager_targeter.cpp11
4 files changed, 0 insertions, 35 deletions
diff --git a/src/mongo/s/commands/cluster_split_cmd.cpp b/src/mongo/s/commands/cluster_split_cmd.cpp
index 47f42767a5a..114d0f27bba 100644
--- a/src/mongo/s/commands/cluster_split_cmd.cpp
+++ b/src/mongo/s/commands/cluster_split_cmd.cpp
@@ -232,10 +232,6 @@ public:
}
middle = cm->getShardKeyPattern().normalizeShardKey(middle);
-
- // Check shard key size when manually provided
- uassertStatusOK(ShardKeyPattern::checkShardKeySize(middle));
-
chunk.emplace(cm->findIntersectingChunkWithSimpleCollation(middle));
if (chunk->getMin().woCompare(middle) == 0 || chunk->getMax().woCompare(middle) == 0) {
diff --git a/src/mongo/s/shard_key_pattern.cpp b/src/mongo/s/shard_key_pattern.cpp
index 07362cc5fc1..99435233b92 100644
--- a/src/mongo/s/shard_key_pattern.cpp
+++ b/src/mongo/s/shard_key_pattern.cpp
@@ -154,18 +154,6 @@ BSONElement findEqualityElement(const EqualityMatches& equalities, const FieldRe
} // namespace
-constexpr int ShardKeyPattern::kMaxShardKeySizeBytes;
-
-Status ShardKeyPattern::checkShardKeySize(const BSONObj& shardKey) {
- if (shardKey.objsize() <= kMaxShardKeySizeBytes)
- return Status::OK();
-
- return {ErrorCodes::ShardKeyTooBig,
- str::stream() << "shard keys must be less than " << kMaxShardKeySizeBytes
- << " bytes, but key " << shardKey << " is " << shardKey.objsize()
- << " bytes"};
-}
-
Status ShardKeyPattern::checkShardKeyIsValidForMetadataStorage(const BSONObj& shardKey) {
for (const auto& elem : shardKey) {
if (!isValidShardKeyElementForStorage(elem)) {
diff --git a/src/mongo/s/shard_key_pattern.h b/src/mongo/s/shard_key_pattern.h
index 6d177188b13..e8d1d0da8e1 100644
--- a/src/mongo/s/shard_key_pattern.h
+++ b/src/mongo/s/shard_key_pattern.h
@@ -66,14 +66,6 @@ typedef std::vector<std::pair<BSONObj, BSONObj>> BoundList;
*/
class ShardKeyPattern {
public:
- // Maximum size of shard key
- static constexpr int kMaxShardKeySizeBytes = 512;
-
- /**
- * Helper to check shard key size and generate an appropriate error message.
- */
- static Status checkShardKeySize(const BSONObj& shardKey);
-
/**
* Validates whether the specified shard key is valid to be written as part of the sharding
* metadata.
diff --git a/src/mongo/s/write_ops/chunk_manager_targeter.cpp b/src/mongo/s/write_ops/chunk_manager_targeter.cpp
index 96a6d301c97..d6b49027c1f 100644
--- a/src/mongo/s/write_ops/chunk_manager_targeter.cpp
+++ b/src/mongo/s/write_ops/chunk_manager_targeter.cpp
@@ -156,12 +156,6 @@ StatusWith<BSONObj> getUpdateExpr(OperationContext* opCtx,
} else if (auto idElt = idFromQuery.getValue()[kIdFieldName]) {
updateExpr = updateExpr.addField(idElt);
}
- // Confirm that the finalized replacement shard key is valid.
- auto skStatus =
- ShardKeyPattern::checkShardKeySize(shardKeyPattern.extractShardKeyFromDoc(updateExpr));
- if (!skStatus.isOK()) {
- return skStatus;
- }
return updateExpr;
}
@@ -395,11 +389,6 @@ StatusWith<ShardEndpoint> ChunkManagerTargeter::targetInsert(OperationContext* o
<< " does not contain shard key for pattern "
<< _routingInfo->cm()->getShardKeyPattern().toString()};
}
-
- // Check shard key size on insert
- Status status = ShardKeyPattern::checkShardKeySize(shardKey);
- if (!status.isOK())
- return status;
}
// Target the shard key or database primary