Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-55686

Prevent resharding coordinator document from exceeding 16MB BSON size limit

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Backport Requested:
      v5.0
    • Sprint:
      Sharding 2021-06-14, Sharding 2021-05-31
    • 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.

        Attachments

          Activity

            People

            Assignee:
            haley.connelly Haley Connelly
            Reporter:
            max.hirschhorn Max Hirschhorn
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: