jstests/noPassthrough/libs/index_build.js
/**
     * Restarts the given node, ensuring that the index builds write their state to disk upon
     * shutdown and are completed upon startup. Returns the build UUIDs of the index builds that
     * were resumed.
     */
Restarts the given node, ensuring that the index builds write their state to disk upon
shutdown and are completed upon startup. Returns the build UUIDs of the index builds that
were resumed.
Restarts the given node ensuring that the index builds write their state to disk upon shutdown and are completed upon startup . Returns the build UUIDs of the index builds that were resumed .
static restartWithUpgrade(rst,
                              upg,
                              conn,
                              coll,
                              indexNames,
                              failPoints,
                              failPointsIteration,
                              shouldComplete = true,
                              failPointAfterStartup,
                              runBeforeStartup,
                              options) {
        clearRawMongoProgramOutput();
        const buildUUIDs = ResumableIndexBuildTest.generateFailPointsData(
            coll, failPoints, failPointsIteration, indexNames);
        const shutdownFpTimesEntered = configureFailPoint(conn, "hangBeforeShutdown").timesEntered;
        const awaitContinueShutdown = startParallelShell(
            funWithArgs(function(failPoints, shutdownFpTimesEntered) {
                load("jstests/libs/fail_point_util.js");
                load("jstests/noPassthrough/libs/index_build.js");
                assert.commandWorked(db.adminCommand({
                    waitForFailPoint: "hangBeforeShutdown",
                    timesEntered: shutdownFpTimesEntered + 1,
                    maxTimeMS: kDefaultWaitForFailPointTimeout
                }));
                let failPointForSingleIndexBuild;
                for (const failPoint of failPoints) {
                    failPointForSingleIndexBuild =
                        configureFailPoint(db.getMongo(), failPoint.name, failPoint.data);
                }
                ResumableIndexBuildTest.waitForFailPoints(db.getMongo(),
                                                          ["hangBeforeBuildingIndex"],
                                                          failPoints,
                                                          failPointForSingleIndexBuild);
                assert.commandWorked(
                    db.adminCommand({configureFailPoint: "hangBeforeShutdown", mode: "off"}));
            }, failPoints, shutdownFpTimesEntered), conn.port);
        rst.stop(conn);
        awaitContinueShutdown();
        for (const buildUUID of buildUUIDs) {
            assert(RegExp("4841502.*" + buildUUID).test(rawMongoProgramOutput()));
        }
        if (runBeforeStartup)
            runBeforeStartup();
        const setParameter = {logComponentVerbosity: tojson({index: 1, storage: 1})};
        if (failPointAfterStartup) {
            Object.extend(setParameter, {
                ["failpoint." + failPointAfterStartup]: tojson({mode: "alwaysOn"}),
            });
        }
        const defaultOptions = {noCleanData: true, setParameter: setParameter};
        upg.start(conn, Object.assign(defaultOptions, options || {}));
        if (shouldComplete) {
            ResumableIndexBuildTest.assertCompleted(
                conn, coll, buildUUIDs, ResumableIndexBuildTest.flatten(indexNames));
        }
        for (const fp of failPoints) {
            delete fp.data;
        }
        return buildUUIDs;
    }
static restartWithUpgrade ( rst , upg , conn , coll , indexNames , failPoints , failPointsIteration , shouldComplete = true , failPointAfterStartup , runBeforeStartup , options ) { clearRawMongoProgramOutput ( ) ; const buildUUIDs = ResumableIndexBuildTest . generateFailPointsData ( coll , failPoints , failPointsIteration , indexNames ) ; const shutdownFpTimesEntered = configureFailPoint ( conn , "hangBeforeShutdown" ) . timesEntered ; const awaitContinueShutdown = startParallelShell ( funWithArgs ( function ( failPoints , shutdownFpTimesEntered ) { load ( "jstests/libs/fail_point_util.js" ) ; load ( "jstests/noPassthrough/libs/index_build.js" ) ; assert . commandWorked ( db . adminCommand ( { waitForFailPoint : "hangBeforeShutdown" , timesEntered : shutdownFpTimesEntered + 1 , maxTimeMS : kDefaultWaitForFailPointTimeout } ) ) ; let failPointForSingleIndexBuild ; for ( const failPoint of failPoints ) { failPointForSingleIndexBuild = configureFailPoint ( db . getMongo ( ) , failPoint . name , failPoint . data ) ; } ResumableIndexBuildTest . waitForFailPoints ( db . getMongo ( ) , [ "hangBeforeBuildingIndex" ] , failPoints , failPointForSingleIndexBuild ) ; assert . commandWorked ( db . adminCommand ( { configureFailPoint : "hangBeforeShutdown" , mode : "off" } ) ) ; } , failPoints , shutdownFpTimesEntered ) , conn . port ) ; rst . stop ( conn ) ; awaitContinueShutdown ( ) ; for ( const buildUUID of buildUUIDs ) { assert ( RegExp ( "4841502.*" + buildUUID ) . test ( rawMongoProgramOutput ( ) ) ) ; } if ( runBeforeStartup ) runBeforeStartup ( ) ; const setParameter = { logComponentVerbosity : tojson ( { index : 1 , storage : 1 } ) } ; if ( failPointAfterStartup ) { Object . extend ( setParameter , { [ "failpoint." + failPointAfterStartup ] : tojson ( { mode : "alwaysOn" } ) , } ) ; } const defaultOptions = { noCleanData : true , setParameter : setParameter } ; upg . start ( conn , Object . assign ( defaultOptions , options || { } ) ) ; if ( shouldComplete ) { ResumableIndexBuildTest . assertCompleted ( conn , coll , buildUUIDs , ResumableIndexBuildTest . flatten ( indexNames ) ) ; } for ( const fp of failPoints ) { delete fp . data ; } return buildUUIDs ; }
Restarts the given node, ensuring that the index builds write their state to disk upon
 shutdown and are completed upon startup.
Restarts the given node ensuring that the index builds write their state to disk upon shutdown and are completed upon startup .
// Don't interrupt the index builds for shutdown until they are at the desired point. // Wait until we hang before shutdown to ensure that we do not move the index builds // forward before the step down process is complete. // Move the index builds forward to the points that we want them to be interrupted // for shutdown at. // Disabling this failpoint will allow shutdown to continue and cause the operation // context to be killed. This will cause the failpoint specified by failPointName // to be interrupted and allow the index builds to be interrupted for shutdown at // their current locations. // Ensure that the resumable index build state was written to disk upon clean shutdown. // Ensure that the index builds were completed upon the node starting back up.