jstests/core/txns/libs/prepare_helpers.js
/**
     * Waits for the oplog entry of the given timestamp to be majority committed.
     */
Waits for the oplog entry of the given timestamp to be majority committed.
Waits for the oplog entry of the given timestamp to be majority committed .
function awaitMajorityCommitted(replSet, timestamp) {
        print(`Waiting for majority commit point to advance past the given timestamp ${
            tojson(timestamp)}`);
        const primary = replSet.getPrimary();
        assert.soon(() => {
            const ts = assert.commandWorked(primary.adminCommand({replSetGetStatus: 1}))
                           .optimes.lastCommittedOpTime.ts;
            if (timestampCmp(ts, timestamp) >= 0) {
                print(`Finished awaiting lastCommittedOpTime.ts, now at ${tojson(ts)}`);
                return true;
            } else {
                print(`Awaiting lastCommittedOpTime.ts, now at ${tojson(ts)}`);
                return false;
            }
        }, "Timeout waiting for majority commit point", ReplSetTest.kDefaultTimeoutMS, 1000);
    }
function awaitMajorityCommitted ( replSet , timestamp ) { print ( ` ${ tojson ( timestamp ) } ` ) ; const primary = replSet . getPrimary ( ) ; assert . soon ( ( ) => { const ts = assert . commandWorked ( primary . adminCommand ( { replSetGetStatus : 1 } ) ) . optimes . lastCommittedOpTime . ts ; if ( timestampCmp ( ts , timestamp ) >= 0 ) { print ( ` ${ tojson ( ts ) } ` ) ; return true ; } else { print ( ` ${ tojson ( ts ) } ` ) ; return false ; } } , "Timeout waiting for majority commit point" , ReplSetTest . kDefaultTimeoutMS , 1000 ) ; }
Waits for the oplog entry of the given timestamp to be majority committed.
Waits for the oplog entry of the given timestamp to be majority committed .