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

Handle local errors on mongos encountered when attempting to send bulkWrite sub-batches

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • Repl 2023-09-04, Repl 2023-09-18

      Our current logic for processing responses from the MultistatementTransactionsRequestSender will just directly return to the user any local errors encountered while trying to send sub-batches to shards.

      However, this is not always desirable because:

      1. If it's an unordered write, we should still try to complete the rest of the writes following those that failed in this sub-batch
      2. If it's an ordered write, we want to report results for any writes that succeeded before the sub-batch errored 

      We should update this logic to do something similar to batched writes, which is:

      1. if the error is a transient transaction error, return it directly to the user as a top-level error so the client may retry the entire transaction
      2. if the error is because the mongos is shutting down,  return it directly to the user as a top-level error so the client may retry the command against another mongos
      3. otherwise, record the error as a per-statement error within the bulkWrite cursor (i.e. record it for the first write in the sub-batch if doing ordered writes, or all writes in the sub-batch for unordered)
      4. if we are in a transaction, abort execution (even if we are doing an unordered write) since we abort transactions on any errors 

            Assignee:
            kaitlin.mahar@mongodb.com Kaitlin Mahar
            Reporter:
            kaitlin.mahar@mongodb.com Kaitlin Mahar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: