jstests/concurrency/fsm_workload_helpers/cleanup_txns.js
/**
 * Abort the transaction on the session and return result.
 */
Abort the transaction on the session and return result.
Abort the transaction on the session and return result .
function abortTransaction(sessionAwareDB, txnNumber) {
    assert(sessionAwareDB.getSession() != null);
    let rawDB = sessionAwareDB.getSession().getClient().getDB(sessionAwareDB.getName());
    const abortErrorCodes = [
        ErrorCodes.NoSuchTransaction,
        ErrorCodes.TransactionCommitted,
        ErrorCodes.TransactionTooOld,
        ErrorCodes.Interrupted,
        ErrorCodes.LockTimeout
    ];
    const abortCmd = {
        abortTransaction: 1,
        lsid: sessionAwareDB.getSession().getSessionId(),
        txnNumber: NumberLong(txnNumber),
        autocommit: false
    };
    const res = rawDB.adminCommand(abortCmd);
    return assert.commandWorkedOrFailedWithCode(
        res, abortErrorCodes, () => `cmd: ${tojson(abortCmd)}`);
}
function abortTransaction ( sessionAwareDB , txnNumber ) { assert ( sessionAwareDB . getSession ( ) != null ) ; let rawDB = sessionAwareDB . getSession ( ) . getClient ( ) . getDB ( sessionAwareDB . getName ( ) ) ; const abortErrorCodes = [ ErrorCodes . NoSuchTransaction , ErrorCodes . TransactionCommitted , ErrorCodes . TransactionTooOld , ErrorCodes . Interrupted , ErrorCodes . LockTimeout ] ; const abortCmd = { abortTransaction : 1 , lsid : sessionAwareDB . getSession ( ) . getSessionId ( ) , txnNumber : NumberLong ( txnNumber ) , autocommit : false } ; const res = rawDB . adminCommand ( abortCmd ) ; return assert . commandWorkedOrFailedWithCode ( res , abortErrorCodes , ( ) => ` ${ tojson ( abortCmd ) } ` ) ; }
Abort the transaction on the session and return result.
Abort the transaction on the session and return result .
// Don't use the given session as it might be in a state we don't want to be and // because we are trying to abort with arbitrary txnNumber.