jstests/concurrency/fsm_workload_helpers/snapshot_read_utils.js
/**
 * Performs a snapshot getmore. This function is to be used in conjunction with doSnapshotFind.
 */
Performs a snapshot getmore. This function is to be used in conjunction with doSnapshotFind.
Performs a snapshot getmore . This function is to be used in conjunction with doSnapshotFind .
function doSnapshotGetMore(collName, data, getMoreErrorCodes, commitTransactionErrorCodes) {
    if (bsonWoCompare({_: data.cursorId}, {_: NumberLong(0)}) === 0) {
        return;
    }
    const getMoreCmd = {
        getMore: data.cursorId,
        collection: collName,
        batchSize: data.batchSize,
        txnNumber: NumberLong(data.txnNumber),
        stmtId: NumberInt(data.stmtId++),
        autocommit: false
    };
    let res = data.sessionDb.runCommand(getMoreCmd);
    if (!TransactionsUtil.isTransientTransactionError(res)) {
        assert.commandWorkedOrFailedWithCode(
            res, getMoreErrorCodes, () => `cmd: ${tojson(getMoreCmd)}`);
    }
    const commitCmd = {
        commitTransaction: 1,
        txnNumber: NumberLong(data.txnNumber),
        autocommit: false
    };
    res = data.sessionDb.adminCommand(commitCmd);
    assert.commandWorkedOrFailedWithCode(
        res, commitTransactionErrorCodes, () => `cmd: ${tojson(commitCmd)}`);
}
function doSnapshotGetMore ( collName , data , getMoreErrorCodes , commitTransactionErrorCodes ) { if ( bsonWoCompare ( { _ : data . cursorId } , { _ : NumberLong ( 0 ) } ) === 0 ) { return ; } const getMoreCmd = { getMore : data . cursorId , collection : collName , batchSize : data . batchSize , txnNumber : NumberLong ( data . txnNumber ) , stmtId : NumberInt ( data . stmtId ++ ) , autocommit : false } ; let res = data . sessionDb . runCommand ( getMoreCmd ) ; if ( ! TransactionsUtil . isTransientTransactionError ( res ) ) { assert . commandWorkedOrFailedWithCode ( res , getMoreErrorCodes , ( ) => ` ${ tojson ( getMoreCmd ) } ` ) ; } const commitCmd = { commitTransaction : 1 , txnNumber : NumberLong ( data . txnNumber ) , autocommit : false } ; res = data . sessionDb . adminCommand ( commitCmd ) ; assert . commandWorkedOrFailedWithCode ( res , commitTransactionErrorCodes , ( ) => ` ${ tojson ( commitCmd ) } ` ) ; }
Performs a snapshot getmore.
Performs a snapshot getmore .
// A transaction request can always fail with a transient transaction error, so only check the // specific error code if it is not labeled as transient.