[SERVER-34207] Restore _txnState to kNone before returning SnapshotTooOld error Created: 30/Mar/18  Updated: 27/Oct/23  Resolved: 17/Apr/18

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

Type: Bug Priority: Major - P3
Reporter: Tess Avitabile (Inactive) Assignee: Backlog - Replication Team
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Replication
Operating System: ALL
Participants:

 Description   

When Session::unstashTransactionResources() throws a SnapshotTooOld error, we do not abort the transaction, since unstashTransactionResources() is not within the ScopeGuard that aborts the transaction. However, if the command was part of a multi-statement transaction, we leave the Session in a state where _txnState=kInProgress and _txnResourceStash is empty. This is an inconsistent state for the Session. It also means that when the mongos retries the first statement of the transaction, it must leave off the startTransaction argument, since the transaction is already in progress (which is incorrect). Instead, when we return a SnapshotTooOld error, we should "forget" that the current transaction ever happened, so that the mongos can retry with startTransaction:true.



 Comments   
Comment by Tess Avitabile (Inactive) [ 30/Mar/18 ]

I did not end up having to fix this issue in order to re-commit SERVER-34011, since the mongos is actually able to retry snapshot reads after receiving SnapshotTooOld. The issue there was that StaleEpoch errors aborted the transaction, and the mongos was unable to retry. The Sharding team is intending to address that issue.

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