jstests/replsets/too_stale_secondary.js
/**
 * Overflows the oplog of a given node.
 *
 * To detect oplog overflow, we continuously insert large documents until we
 * detect that the first entry of the oplog is no longer the same as when we started. This
 * implies that the oplog attempted to grow beyond its maximum size i.e. it
 * has overflowed/rolled over.
 *
 * Each document will be inserted with a writeConcern given by 'writeConcern'.
 *
 */
Overflows the oplog of a given node.
To detect oplog overflow, we continuously insert large documents until we
detect that the first entry of the oplog is no longer the same as when we started. This
implies that the oplog attempted to grow beyond its maximum size i.e. it
has overflowed/rolled over.

Each document will be inserted with a writeConcern given by 'writeConcern'.
Overflows the oplog of a given node . To detect oplog overflow we continuously insert large documents until we detect that the first entry of the oplog is no longer the same as when we started . This implies that the oplog attempted to grow beyond its maximum size i . e . it has overflowed / rolled over . Each document will be inserted with a writeConcern given by ' writeConcern ' .
function overflowOplog(conn, db, writeConcern) {
    var firstOplogEntry = getFirstOplogEntry(primary);
    var collName = "overflow";
    const largeStr = new Array(32 * 1024).join('aaaaaaaa');
    while (bsonWoCompare(getFirstOplogEntry(conn), firstOplogEntry) === 0) {
        assert.commandWorked(
            db[collName].insert({data: largeStr}, {writeConcern: {w: writeConcern}}));
    }
}
function overflowOplog ( conn , db , writeConcern ) { var firstOplogEntry = getFirstOplogEntry ( primary ) ; var collName = "overflow" ; const largeStr = new Array ( 32 * 1024 ) . join ( 'aaaaaaaa' ) ; while ( bsonWoCompare ( getFirstOplogEntry ( conn ) , firstOplogEntry ) === 0 ) { assert . commandWorked ( db [ collName ] . insert ( { data : largeStr } , { writeConcern : { w : writeConcern } } ) ) ; } }
Overflows the oplog of a given node.
Overflows the oplog of a given node .
// Keep inserting large documents until the oplog rolls over.