[SERVER-55686] Prevent resharding coordinator document from exceeding 16MB BSON size limit Created: 01/Apr/21  Updated: 29/Oct/23  Resolved: 03/Jun/21

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 5.0.0-rc1, 5.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Haley Connelly
Resolution: Fixed Votes: 0
Labels: PM-234-M3, PM-234-T-error-flow, post-rc0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Backport Requested:
v5.0
Sprint: Sharding 2021-06-14, Sharding 2021-05-31
Participants:
Story Points: 2

 Description   

Donor and recipient shards periodically update the config.reshardingOperations document on the config server as part of their state changes. Most of the DonorShardContext and RecipientShardContext types are fixed in size. The exception to this for both donor and recipient shards is the abortReason. To prevent the situation where multiple participants have an abortReason causing the update to fail with BSONObjectTooLarge, the donor and recipient shards must truncate their abortReason in the update to the config.reshardingOperations collection.

Things to consider:

  • If serializeErrorToBSON() yields a BSONObj larger than 2000 bytes then the abortReason must be truncated. 2000 bytes is to be generous for when there are a large number of shards (up to 1000) that error simultaneously.
  • Truncate the abortReason by doing the following:
    1. Serialize the Status to a string with Status::toString(). This enables the Status to partially include a serialized form of its ErrorExtraInfo if its reason is short enough.
    2. Truncate the string using UTF8SafeTruncation().
    3. Create a new Status using a new ReshardCollectionTruncatedError code with the truncated string as the error reason.


 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 07/Jun/21 ]

Author:

{'name': 'Haley Connelly', 'email': 'haley.connelly@mongodb.com', 'username': 'haleyConnelly'}

Message: SERVER-55686 Prevent resharding coordinator document from exceeding 16MB BSON size limit
Branch: v5.0
https://github.com/mongodb/mongo/commit/cfc835ec83a9db2ecfd67c95099a0321bafe0e38

Comment by Githook User [ 03/Jun/21 ]

Author:

{'name': 'Haley Connelly', 'email': 'haley.connelly@mongodb.com', 'username': 'haleyConnelly'}

Message: SERVER-55686 Prevent resharding coordinator document from exceeding 16MB BSON size limit
Branch: master
https://github.com/mongodb/mongo/commit/1274f16682fd01d35c98db39b202d7acdf3e554b

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