[SERVER-37181] commitTransaction command can attach TransientTransactionError label on more errors Created: 17/Sep/18  Updated: 27/Oct/23  Resolved: 19/Sep/18

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Spencer Brody (Inactive) Assignee: Backlog - Replication Team
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-37179 Wait for specified write concern when... Closed
Assigned Teams:
Replication
Backport Requested:
v4.0
Participants:

 Description   

Currently the commitTransaction command only gets the TransientTransactionError label on a smaller set of error codes than most other commands within transactions (see https://github.com/mongodb/mongo/blob/8956deeef7bd4013d3de4092374fb9a2c329e2a5/src/mongo/db/handle_request_response.cpp#L49).

There's no reason for this, however. commitTransaction should be able to get the TransientTransactionError on all the same codes as every other transaction command, with the one exception of NoSuchTransaction in the case of a writeConcern error (see SERVER-37179)



 Comments   
Comment by Spencer Brody (Inactive) [ 19/Sep/18 ]

I'm not totally sure it's possible to get NotMaster but still have the transaction actually commit. But regardless I agree with your description of what the desired user behavior should be, so adding the label in these cases seems potentially risky for little to no benefit. Closing "Works as Designed"

Comment by Tess Avitabile (Inactive) [ 18/Sep/18 ]

Why is it okay to attach TransientTransactionError to the retryable error codes? You should only get a TransientTransactionError if you transaction definitely aborted. For a NotMaster error or a ShutdownInProgress error, the transaction could have already committed on a prior commitTransaction command. The correct thing to do in that situation is to keep attempting commitTransaction until you get ok:1 or a NoSuchTransaction error with a TransientTransactionError label.

Generated at Thu Feb 08 04:45:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.