jstests/replsets/kill_prepared_transaction_commit_abort.js
/**
 * Creates 'num' sessions and starts and prepares a transaction on each. Returns an array of
 * sessions included with the commit timestamp for each prepared transaction and the current state
 * of that transaction.
 */
Creates 'num' sessions and starts and prepares a transaction on each. Returns an array of
sessions included with the commit timestamp for each prepared transaction and the current state
of that transaction.
Creates ' num ' sessions and starts and prepares a transaction on each . Returns an array of sessions included with the commit timestamp for each prepared transaction and the current state of that transaction .
function createPreparedTransactions(num) {
    let sessions = [];
    for (let i = 0; i < num; i++) {
        const priSession = primary.startSession();
        const priSessionDB = priSession.getDatabase(dbName);
        const priSessionColl = priSessionDB.getCollection(collName);
        priSession.startTransaction();
        assert.commandWorked(priSessionColl.insert({_id: i}));
        const prepareTimestamp = PrepareHelpers.prepareTransaction(priSession);
        sessions.push(
            {session: priSession, commitTs: prepareTimestamp, state: TxnState.InProgress});
    }
    return sessions;
}
function createPreparedTransactions ( num ) { let sessions = [ ] ; for ( let i = 0 ; i < num ; i ++ ) { const priSession = primary . startSession ( ) ; const priSessionDB = priSession . getDatabase ( dbName ) ; const priSessionColl = priSessionDB . getCollection ( collName ) ; priSession . startTransaction ( ) ; assert . commandWorked ( priSessionColl . insert ( { _id : i } ) ) ; const prepareTimestamp = PrepareHelpers . prepareTransaction ( priSession ) ; sessions . push ( { session : priSession , commitTs : prepareTimestamp , state : TxnState . InProgress } ) ; } return sessions ; }
Creates 'num' sessions and starts and prepares a transaction on each.
Creates ' num ' sessions and starts and prepares a transaction on each .