[SERVER-42368] Remove max shard key value size limit Created: 23/Jul/19  Updated: 29/Oct/23  Resolved: 08/Aug/19

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 4.3.1

Type: Task Priority: Major - P3
Reporter: Jack Mulrow Assignee: James Heppenstall (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
is documented by DOCS-12951 Investigate changes in SERVER-42368: ... Closed
Related
related to SERVER-34877 findAndModify with upsert allows crea... Closed
related to SERVER-42646 Cap splitVector response at max BSONO... Closed
is related to SERVER-34877 findAndModify with upsert allows crea... Closed
Backwards Compatibility: Minor Change
Sprint: Sharding 2019-08-12
Participants:

 Description   

Shard key values have a max size limit of 512 bytes which is enforced on mongos when writing new documents (e.g. for inserts) and when validating the split points when committing a chunk split.

Because of this, if a user refined the shard key of their collection to include a field all documents have large values for, they would be unable split their chunks because all possible split points would be over the limit. To avoid this scenario without scanning the documents in a collection before refining the collection's shard key and now that that limit on index keys has been lifted (PM-284), this limit should be removed.



 Comments   
Comment by James Heppenstall (Inactive) [ 12/Aug/19 ]

In https://docs.mongodb.com/manual/core/sharded-cluster-requirements/#sharding-operational-restrictions under 'Sharding Existing Collection Data Size', it should also be mentioned that, with the 512 bytes limit lifted, one might have trouble initially sharding an existing collection that is too large. A workaround for this issue would be to shard the collection with a prefix of the desired shard key and then refine the shard key to the desired key afterwards using the new refineCollectionShardKey command.

Comment by Githook User [ 08/Aug/19 ]

Author:

{'name': 'Jamie Heppenstall', 'email': 'jamie.heppenstall@mongodb.com', 'username': 'JamesHeppenstall'}

Message: SERVER-42368 Remove max shard key size limit of 512 bytes
Branch: master
https://github.com/mongodb/mongo/commit/72520f60c55cf5a78ac3f1a25166ac7bba2c6a3e

Generated at Thu Feb 08 05:00:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.