jstests/noPassthrough/change_stream_resume_before_add_shard.js
// ensures that the "initiating set" entry cannot be rolled back.
ensures that the "initiating set" entry cannot be rolled back.
ensures that the " initiating set " entry cannot be rolled back .
function addShardToCluster(shardName) {
    const replTest = new ReplSetTest({name: shardName, nodes: 1, nodeOptions: rsNodeOptions});
    replTest.startSet({shardsvr: ""});
    replTest.initiate();
    assert.commandWorked(st.s.adminCommand({addShard: replTest.getURL(), name: shardName}));
    const firstOplogEntry = replTest.getPrimary().getCollection("local.oplog.rs").findOne();
    assert.docEq(firstOplogEntry.o, {msg: "initiating set"});
    assert.eq(firstOplogEntry.op, "n");
    return replTest;
}
function addShardToCluster ( shardName ) { const replTest = new ReplSetTest ( { name : shardName , nodes : 1 , nodeOptions : rsNodeOptions } ) ; replTest . startSet ( { shardsvr : "" } ) ; replTest . initiate ( ) ; assert . commandWorked ( st . s . adminCommand ( { addShard : replTest . getURL ( ) , name : shardName } ) ) ; const firstOplogEntry = replTest . getPrimary ( ) . getCollection ( "local.oplog.rs" ) . findOne ( ) ; assert . docEq ( firstOplogEntry . o , { msg : "initiating set" } ) ; assert . eq ( firstOplogEntry . op , "n" ) ; return replTest ; }
ensures that the "initiating set" entry cannot be rolled back.
ensures that the " initiating set " entry cannot be rolled back .
// Verify that the new shard's first oplog entry contains the string "initiating set". This // is used by change streams as a sentinel to indicate that no writes have occurred on the // replica set before this point.