[SERVER-36847] Procedure to abort in-progress transactions in snapshot_read_utils.js no longer works Created: 24/Aug/18  Updated: 29/Oct/23  Resolved: 24/Aug/18

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

Type: Bug 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:
Depends
Related
is related to SERVER-36848 Bumping txnNumber on Session must alw... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Repl 2018-08-27, Repl 2018-09-10
Participants:
Linked BF Score: 36

 Description   

In snapshot_read_utils.js, there is a procedure to abort any transaction started by the FSM workload. It runs abortTransaction on all txnNumbers from the latest one the thread could have used down to 0:

for (let i = data.txnNumber; i >= 0; i--) {
    let res = abortTransaction(data.sessionDb, i, abortErrorCodes);
    if (res.ok === 1) {
        break;
    }
}

Unfortunately, this procedure no longer works. If there is an open transaction with txnNumber=i, then when we run abortTransaction with txnNumber=j>i, we receive an error NoSuchTransaction with message "Given transaction number j does not match any in-progress transactions. The active transaction number is i". Then when we try to run abortTransaction with txnNumber=i, we receive an error TransactionTooOld with message "Cannot start transaction i on session <lsid> because a newer transaction j has already started". The transaction with txnNumber=i then remains open after the cleanup procedure is done.

This can be fixed by running abortTransaction on each txnNumber in increasing order.

This issue does not exist on 4.0, since on 4.0, we error if we receive a higher txnNumber without startTransaction:true prior to bumping the txnNumber on Session. This issue is new with the Session refactor.



 Comments   
Comment by Githook User [ 24/Aug/18 ]

Author:

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

Message: SERVER-36847 Fix procedure to abort in-progress transactions in snapshot_read_utils.js
Branch: master
https://github.com/mongodb/mongo/commit/70882697008a4f52782ec20953790cbecd1b7add

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