masteryhx commented on a change in pull request #18224:
URL: https://github.com/apache/flink/pull/18224#discussion_r819269474



##########
File path: 
flink-tests/src/test/java/org/apache/flink/test/checkpointing/ChangelogPeriodicMaterializationRescaleITCase.java
##########
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.test.checkpointing;
+
+import org.apache.flink.api.common.JobID;
+import org.apache.flink.runtime.jobgraph.JobGraph;
+import org.apache.flink.runtime.jobgraph.SavepointRestoreSettings;
+import org.apache.flink.runtime.state.AbstractStateBackend;
+import org.apache.flink.runtime.state.StateHandleID;
+import org.apache.flink.streaming.api.environment.CheckpointConfig;
+import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
+import org.apache.flink.testutils.junit.SharedReference;
+import org.apache.flink.util.ExceptionUtils;
+import org.apache.flink.util.Preconditions;
+
+import org.junit.Test;
+
+import java.io.File;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import static 
org.apache.flink.test.util.TestUtils.getMostRecentCompletedCheckpoint;
+
+/**
+ * This verifies that rescale works correctly for Changelog state backend with 
materialized state /
+ * non-materialized state.
+ */
+public class ChangelogPeriodicMaterializationRescaleITCase
+        extends ChangelogPeriodicMaterializationTestBase {
+
+    public ChangelogPeriodicMaterializationRescaleITCase(
+            AbstractStateBackend delegatedStateBackend) {
+        super(delegatedStateBackend);
+    }
+
+    @Test
+    public void testRescaleOut() throws Exception {
+        testRescale(NUM_SLOTS / 2, NUM_SLOTS);
+    }
+
+    @Test
+    public void testRescaleIn() throws Exception {
+        testRescale(NUM_SLOTS, NUM_SLOTS / 2);
+    }
+
+    private void testRescale(int firstParallelism, int secondParallelism) 
throws Exception {
+        File firstCheckpointFolder = TEMPORARY_FOLDER.newFolder();
+        JobID firstJobID = generateJobID();
+        SharedReference<Set<StateHandleID>> currentMaterializationId =
+                sharedObjects.add(ConcurrentHashMap.newKeySet());
+
+        StreamExecutionEnvironment env =
+                getEnv(delegatedStateBackend, firstCheckpointFolder, 50, 0, 
20, 0);
+        env.getCheckpointConfig()
+                .setExternalizedCheckpointCleanup(
+                        
CheckpointConfig.ExternalizedCheckpointCleanup.RETAIN_ON_CANCELLATION);

Review comment:
       Updated. I have also tried to pick your pr for FLINK-26455 to check, and 
it works.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to