[SERVER-80481] Handle local errors on mongos encountered when attempting to send bulkWrite sub-batches Created: 28/Aug/23  Updated: 29/Oct/23  Resolved: 13/Sep/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.2.0-rc0

Type: Task Priority: Major - P3
Reporter: Kaitlin Mahar Assignee: Kaitlin Mahar
Resolution: Fixed Votes: 0
Labels: milestone-2
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-79506 Get all bulkWrite js core tests runni... Closed
is depended on by SERVER-81006 Handle local errors executing retryab... Closed
Backwards Compatibility: Fully Compatible
Sprint: Repl 2023-09-04, Repl 2023-09-18
Participants:

 Description   

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 


 Comments   
Comment by Githook User [ 13/Sep/23 ]

Author:

{'name': 'Kaitlin Mahar', 'email': 'kaitlin.mahar@mongodb.com', 'username': 'kmahar'}

Message: SERVER-80481 Handle local errors executing bulkWrite child batches on mongos
Branch: master
https://github.com/mongodb/mongo/commit/783efabe893b5e30826991e4cf7df7fe3bc7598e

Generated at Thu Feb 08 06:43:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.