[SERVER-38850] Perform noop write before returning NoSuchTransaction error Created: 04/Jan/19  Updated: 29/Oct/23  Resolved: 16/Jan/19

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

Type: Task Priority: Major - P3
Reporter: Tess Avitabile (Inactive) Assignee: Tess Avitabile (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-38135 Do not allow transactions on shard se... Closed
is related to SERVER-38132 Aborting a transaction must always up... Closed
is related to SERVER-38133 When asked to continue a transaction ... Closed
Backwards Compatibility: Fully Compatible
Sprint: Repl 2019-01-14, Repl 2019-01-28
Participants:
Linked BF Score: 11

 Description   

If a command returns a NoSuchTransaction error and there was a write concern provided on the command, perform a noop write before waiting for write concern. This ensures that if the command was run with write concern w:majority, and the write concern succeeds, then it is safe to attach the TransientTransactionError label. That is, it is safe for the driver/application to retry the entire transaction, since the node is primary, so the transaction cannot have committed on a newer primary.

Since secondaries reject all commands with write concern, we will not attempt to perform the noop write on secondaries.

This ticket must resolve all TODOs for SERVER-38132 and SERVER-38133, since it replaces those two tickets.



 Comments   
Comment by Githook User [ 16/Jan/19 ]

Author:

{'username': 'tessavitabile', 'email': 'tess.avitabile@mongodb.com', 'name': 'Tess Avitabile'}

Message: SERVER-38850 Perform noop write before returning NoSuchTransaction error
Branch: master
https://github.com/mongodb/mongo/commit/16d1e675286d54ca9604d85b144d88fb85e5c1bc

Comment by Tess Avitabile (Inactive) [ 15/Jan/19 ]

shane.harvey, yes, we would see the error code NoSuchTransaction and a writeConcernError. Note that this is already the case after SERVER-37179, which added the wait for writeConcern when returning NoSuchTransaction. This ticket just ensures that we always perform a write when returning NoSuchTransaction.

Comment by Shane Harvey [ 14/Jan/19 ]

One question here. Normally a command waits for write concern after it has succeeded on the primary. If the write concern fails the response will indicate the command succeeded with a "writeConcernError" field, like this:

{ok: 1, writeConcernError: {code: 91, codeName: "ShutdownInProgress"}}

In this ticket however, the server waits for write concern after a failed command. So what will the final response be when the write concern also fails? This?

{ok: 0, code: 251, codeName: 'NoSuchTransaction', writeConcernError: {code: 91, codeName: "ShutdownInProgress"}}

Comment by Tess Avitabile (Inactive) [ 14/Jan/19 ]

This ticket will not resolve TODOs for SERVER-38133, since this will be handled by SERVER-38978.

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