Priority: Major - P3
Affects Version/s: 4.2.12
Batch write operations could either return a top level error:
or a nested array of writeErrors:
Since our current retryable-write specs is a bit vague around the handling of the batchWrite response in case of writeErrors, drivers only implement retries for top-level errors of a batch write response and won't even look at the retry-able errors in the writeErrors array.
The problem is that if a mongos gets shutted down in the middle of a batch write execution instead of returning a response with a top level error it could actually return a nested array that won't be retried by drivers.
So in this case we will have a batch write that fail with a retryable error that won't be retried neither from the mongos nor from the driver.
I suspect that this is the same underlying issue of
SERVER-53624 but that one is specific to mongoDB versions grater than 4.4, given that mongos is attaching retryable error labels only since v4.4.