Code review comment: This test scenario is:   1. changelog disabled(the interval of materialization doesn't work here), get chk-1  to restore.   2. changelog enabled, retore from chk-1, get chk-2(**no materialization occurs, the materialized part of chk-2 is in chk-1**).   3. changelog enable, restore from chk-2, test whether the materialized part in chk-1 is exist.  So, the interval is deliberately set to be long here to avoid materializing. To simulate a scenario where one JOB restore again before one materialization occurs.

Code under review:
public void testSwitchFromDisablingToEnablingInClaimMode() throws Exception {
        File firstCheckpointFolder = TEMPORARY_FOLDER.newFolder();
        MiniCluster miniCluster = cluster.getMiniCluster();
        StreamExecutionEnvironment env1 =
                getEnv(delegatedStateBackend, firstCheckpointFolder, false, 100, 600000);
        JobGraph firstJobGraph = buildJobGraph(env1);

        miniCluster.submitJob(firstJobGraph).get();
        waitForAllTaskRunning(miniCluster, firstJobGraph.getJobID(), true);
        miniCluster.triggerCheckpoint(firstJobGraph.getJobID()).get();
        miniCluster.cancelJob(firstJobGraph.getJobID()).get();
        String firstRestorePath =
                getLatestCompletedCheckpointPath(firstJobGraph.getJobID(), miniCluster).get();

        
        File secondCheckpointFolder = TEMPORARY_FOLDER.newFolder();
        StreamExecutionEnvironment env2 =
                getEnv(delegatedStateBackend, secondCheckpointFolder, true, 100, 60000);
        JobGraph secondJobGraph = buildJobGraph(env2);
        setSavepointRestoreSettings(secondJobGraph, firstRestorePath);

        miniCluster.submitJob(secondJobGraph).get();
        waitForAllTaskRunning(miniCluster, secondJobGraph.getJobID(), true);
        miniCluster.triggerCheckpoint(secondJobGraph.getJobID()).get();
        miniCluster.cancelJob(secondJobGraph.getJobID()).get();
        String secondRestorePath =
                getLatestCompletedCheckpointPath(secondJobGraph.getJobID(), miniCluster).get();

        
        File thirdCheckpointFolder = TEMPORARY_FOLDER.newFolder();
        StreamExecutionEnvironment env3 =
                getEnv(delegatedStateBackend, thirdCheckpointFolder, true, 100, 100);
        JobGraph thirdJobGraph = buildJobGraph(env3);
        setSavepointRestoreSettings(thirdJobGraph, secondRestorePath);
        miniCluster.submitJob(thirdJobGraph).get();
        waitForAllTaskRunning(miniCluster, thirdJobGraph.getJobID(), true);
        Thread.sleep(500);
        miniCluster.triggerCheckpoint(thirdJobGraph.getJobID()).get();
        miniCluster.cancelJob(thirdJobGraph.getJobID()).get();
    }

Line commented on: StreamExecutionEnvironment env1 =

Revised code:
public void testSwitchFromDisablingToEnablingInClaimMode() throws Exception {
        File firstCheckpointFolder = TEMPORARY_FOLDER.newFolder();
        MiniCluster miniCluster = cluster.getMiniCluster();
        StreamExecutionEnvironment env1 =
                getEnv(delegatedStateBackend, firstCheckpointFolder, false, 100, 600000);
        JobGraph firstJobGraph = buildJobGraph(env1);

        miniCluster.submitJob(firstJobGraph).get();
        waitForAllTaskRunning(miniCluster, firstJobGraph.getJobID(), true);
        miniCluster.triggerCheckpoint(firstJobGraph.getJobID()).get();
        miniCluster.cancelJob(firstJobGraph.getJobID()).get();
        String firstRestorePath =
                getLatestCompletedCheckpointPath(firstJobGraph.getJobID(), miniCluster).get();

        
        File secondCheckpointFolder = TEMPORARY_FOLDER.newFolder();
        StreamExecutionEnvironment env2 =
                getEnv(delegatedStateBackend, secondCheckpointFolder, true, 100, 600000);
        JobGraph secondJobGraph = buildJobGraph(env2);
        setSavepointRestoreSettings(secondJobGraph, firstRestorePath);

        miniCluster.submitJob(secondJobGraph).get();
        waitForAllTaskRunning(miniCluster, secondJobGraph.getJobID(), true);
        miniCluster.triggerCheckpoint(secondJobGraph.getJobID()).get();
        miniCluster.cancelJob(secondJobGraph.getJobID()).get();
        String secondRestorePath =
                getLatestCompletedCheckpointPath(secondJobGraph.getJobID(), miniCluster).get();

        
        File thirdCheckpointFolder = TEMPORARY_FOLDER.newFolder();
        StreamExecutionEnvironment env3 =
                getEnv(delegatedStateBackend, thirdCheckpointFolder, true, 100, 100);
        JobGraph thirdJobGraph = buildJobGraph(env3);
        setSavepointRestoreSettings(thirdJobGraph, secondRestorePath);
        miniCluster.submitJob(thirdJobGraph).get();
        waitForAllTaskRunning(miniCluster, thirdJobGraph.getJobID(), true);
        miniCluster.triggerCheckpoint(thirdJobGraph.getJobID()).get();
        miniCluster.cancelJob(thirdJobGraph.getJobID()).get();
    }