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

BulkWrite mongos child batches can break BSON size limit

    • Replication
    • Fully Compatible
    • ALL
    • v8.0
    • Repl 2024-05-13, Repl 2024-05-27

      In bulkWrite we always append the entire nsInfo array to child batches we send from mongos -> mongod. nsInfo supports document sequences but we cannot send document sequences in mongos to mongod communication (see SERVER-77648). This means that any initial bulkWrite sent to mongos that required doc sequencing for the nsInfo will never be able to proceed and send child batches to mongod.

      To fix this we would need to create a new nsInfo array to attach to child batches, this would also require updating the original ops to point to the new index. This is not a difficult fix but needs to be done and tested carefully to make sure we do not break existing correctness.

      It should be pretty rare for users to hit this since it would require writes being done to a lot of very long named namespaces in the same bulkWrite. Even for users who don't see a command failure due to this there can still be some perf improvements by doing this fix, if we have 14MB of just nsInfo then that only leaves 2MB of writes in every child batch which can cause us to send more batches than is optimal, so this fix does not only impact users who need document sequencing for nsInfo.

            Assignee:
            sean.zimmerman@mongodb.com Sean Zimmerman
            Reporter:
            sean.zimmerman@mongodb.com Sean Zimmerman
            Votes:
            0 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated:
              Resolved: