jstests/concurrency/fsm_workload_helpers/snapshot_read_utils.js
/**
 * Performs a getMore on a previously established snapshot cursor. This function is to be used in
 * conjunction with doSnapshotFindAtClusterTime.
 */
Performs a getMore on a previously established snapshot cursor. This function is to be used in
conjunction with doSnapshotFindAtClusterTime.
Performs a getMore on a previously established snapshot cursor . This function is to be used in conjunction with doSnapshotFindAtClusterTime .
function doSnapshotGetMoreAtClusterTime(
    db, collName, data, getMoreErrorCodes, checkSnapshotCorrectness) {
    const getMoreCmd = {
        getMore: data.cursorId,
        collection: collName,
        batchSize: data.batchSize,
    };
    let res = db.runCommand(getMoreCmd);
    assert.commandWorkedOrFailedWithCode(
        res, getMoreErrorCodes, () => `cmd: ${tojson(getMoreCmd)}, res: ${tojson(res)}`);
    const cursor = parseCursor(res);
    if (cursor) {
        data.cursorId = cursor.id;
        if (bsonWoCompare({_: data.cursorId}, {_: NumberLong(0)}) === 0) {
            return;
        }
        if (typeof checkSnapshotCorrectness === "function") {
            assert(cursor.hasOwnProperty("nextBatch"), tojson(res));
            checkSnapshotCorrectness(res);
        }
    } else {
        data.cursorId = NumberLong(0);
    }
}
function doSnapshotGetMoreAtClusterTime ( db , collName , data , getMoreErrorCodes , checkSnapshotCorrectness ) { const getMoreCmd = { getMore : data . cursorId , collection : collName , batchSize : data . batchSize , } ; let res = db . runCommand ( getMoreCmd ) ; assert . commandWorkedOrFailedWithCode ( res , getMoreErrorCodes , ( ) => ` ${ tojson ( getMoreCmd ) } ${ tojson ( res ) } ` ) ; const cursor = parseCursor ( res ) ; if ( cursor ) { data . cursorId = cursor . id ; if ( bsonWoCompare ( { _ : data . cursorId } , { _ : NumberLong ( 0 ) } ) === 0 ) { return ; } if ( typeof checkSnapshotCorrectness === "function" ) { assert ( cursor . hasOwnProperty ( "nextBatch" ) , tojson ( res ) ) ; checkSnapshotCorrectness ( res ) ; } } else { data . cursorId = NumberLong ( 0 ) ; } }
Performs a getMore on a previously established snapshot cursor.
Performs a getMore on a previously established snapshot cursor .
// checkSnapshotCorrectness verifies that the snapshot sees the correct documents.