jstests/noPassthrough/libs/index_build.js
/**
     * Runs the resumable index build test specified by the provided failpoint information and
     * index spec on the provided replica set and namespace. This will specifically be used to test
     * that resuming an index build on the former primary works. Documents specified by sideWrites
     * will be inserted during the initialization phase so that they are inserted into the side
     * writes table and processed during the drain writes phase.
     */
Runs the resumable index build test specified by the provided failpoint information and
index spec on the provided replica set and namespace. This will specifically be used to test
that resuming an index build on the former primary works. Documents specified by sideWrites
will be inserted during the initialization phase so that they are inserted into the side
writes table and processed during the drain writes phase.
Runs the resumable index build test specified by the provided failpoint information and index spec on the provided replica set and namespace . This will specifically be used to test that resuming an index build on the former primary works . Documents specified by sideWrites will be inserted during the initialization phase so that they are inserted into the side writes table and processed during the drain writes phase .
static runOnPrimaryToTestCommitQuorum(rst,
                                          dbName,
                                          collName,
                                          indexSpec,
                                          resumeNodeFailPointName,
                                          otherNodeFailPointName,
                                          sideWrites = [],
                                          postIndexBuildInserts = []) {
        const resumeNode = rst.getPrimary();
        const resumeDB = resumeNode.getDB(dbName);
        const secondary = rst.getSecondary();
        const coll = resumeDB.getCollection(collName);
        const indexName = "resumable_index_build";
        const resumeNodeFp = configureFailPoint(resumeNode, resumeNodeFailPointName);
        const otherNodeFp = configureFailPoint(secondary, otherNodeFailPointName);
        const awaitCreateIndex = ResumableIndexBuildTest.createIndexWithSideWrites(
            rst, function(collName, indexSpec, indexName) {
                assert.commandFailedWithCode(
                    db.getCollection(collName).createIndex(indexSpec, {name: indexName}),
                    ErrorCodes.InterruptedDueToReplStateChange);
            }, coll, indexSpec, indexName, sideWrites);
        otherNodeFp.wait();
        resumeNodeFp.wait();
        const buildUUID = extractUUIDFromObject(
            IndexBuildTest
                .assertIndexesIdHelper(
                    coll, 1, [], [indexName], {includeBuildUUIDs: true})[indexName]
                .buildUUID);
        clearRawMongoProgramOutput();
        rst.stop(resumeNode);
        assert(RegExp("4841502.*" + buildUUID).test(rawMongoProgramOutput()));
        rst.start(resumeNode, {noCleanData: true});
        otherNodeFp.off();
        ResumableIndexBuildTest.assertCompleted(resumeNode, coll, [buildUUID], [indexName]);
        awaitCreateIndex();
        ResumableIndexBuildTest.checkIndexes(
            rst, dbName, collName, [indexName], postIndexBuildInserts);
    }
static runOnPrimaryToTestCommitQuorum ( rst , dbName , collName , indexSpec , resumeNodeFailPointName , otherNodeFailPointName , sideWrites = [ ] , postIndexBuildInserts = [ ] ) { const resumeNode = rst . getPrimary ( ) ; const resumeDB = resumeNode . getDB ( dbName ) ; const secondary = rst . getSecondary ( ) ; const coll = resumeDB . getCollection ( collName ) ; const indexName = "resumable_index_build" ; const resumeNodeFp = configureFailPoint ( resumeNode , resumeNodeFailPointName ) ; const otherNodeFp = configureFailPoint ( secondary , otherNodeFailPointName ) ; const awaitCreateIndex = ResumableIndexBuildTest . createIndexWithSideWrites ( rst , function ( collName , indexSpec , indexName ) { assert . commandFailedWithCode ( db . getCollection ( collName ) . createIndex ( indexSpec , { name : indexName } ) , ErrorCodes . InterruptedDueToReplStateChange ) ; } , coll , indexSpec , indexName , sideWrites ) ; otherNodeFp . wait ( ) ; resumeNodeFp . wait ( ) ; const buildUUID = extractUUIDFromObject ( IndexBuildTest . assertIndexesIdHelper ( coll , 1 , [ ] , [ indexName ] , { includeBuildUUIDs : true } ) [ indexName ] . buildUUID ) ; clearRawMongoProgramOutput ( ) ; rst . stop ( resumeNode ) ; assert ( RegExp ( "4841502.*" + buildUUID ) . test ( rawMongoProgramOutput ( ) ) ) ; rst . start ( resumeNode , { noCleanData : true } ) ; otherNodeFp . off ( ) ; ResumableIndexBuildTest . assertCompleted ( resumeNode , coll , [ buildUUID ] , [ indexName ] ) ; awaitCreateIndex ( ) ; ResumableIndexBuildTest . checkIndexes ( rst , dbName , collName , [ indexName ] , postIndexBuildInserts ) ; }
Runs the resumable index build test specified by the provided failpoint information and
 index spec on the provided replica set and namespace.
Runs the resumable index build test specified by the provided failpoint information and index spec on the provided replica set and namespace .
// Ensure that the index build was completed upon the node starting back up.