jstests/concurrency/fsm_workload_helpers/check_transaction_server_status_invariants.js
/**
 * serverStatus invariant: totalCommitted = sum of each commit type's successful counter.
 */
serverStatus invariant: totalCommitted = sum of each commit type's successful counter.
serverStatus invariant : totalCommitted = sum of each commit type ' s successful counter .
function totalCommittedEqualsSumOfSuccessfulCommitTypes(txnStats) {
    const totalCommitted = Number(txnStats["totalCommitted"]);
    const commitTypeKeys = Object.keys(txnStats.commitTypes);
    const totalSuccessfulCommitTypes = commitTypeKeys.reduce((accum, key) => {
        return accum + Number(txnStats.commitTypes[key].successful);
    }, 0);
    return totalCommitted === totalSuccessfulCommitTypes;
}
function totalCommittedEqualsSumOfSuccessfulCommitTypes ( txnStats ) { const totalCommitted = Number ( txnStats [ "totalCommitted" ] ) ; const commitTypeKeys = Object . keys ( txnStats . commitTypes ) ; const totalSuccessfulCommitTypes = commitTypeKeys . reduce ( ( accum , key ) => { return accum + Number ( txnStats . commitTypes [ key ] . successful ) ; } , 0 ) ; return totalCommitted === totalSuccessfulCommitTypes ; }
serverStatus invariant: totalCommitted = sum of each commit type's successful counter.
serverStatus invariant : totalCommitted = sum of each commit type ' s successful counter .