Jiayi-Liao commented on a change in pull request #15016:
URL: https://github.com/apache/flink/pull/15016#discussion_r603040907



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/state/ttl/TtlStateTestBase.java
##########
@@ -471,6 +473,26 @@ public void 
testRestoreTtlAndRegisterNonTtlStateCompatFailure() throws Exception
         sbetc.createState(ctx().createStateDescriptor(), "");
     }
 
+    @Test
+    public void testIncrementalCleanupWholeState() throws Exception {
+        assumeTrue(incrementalCleanupSupported());
+        initTest(getConfBuilder(TTL).cleanupIncrementally(5, true).build());
+        timeProvider.time = 0;
+        // create enough keys to trigger incremental rehash
+        updateKeys(0, INC_CLEANUP_ALL_KEYS, ctx().updateEmpty);
+        // expire all state
+        timeProvider.time = 120;
+        // trigger state clean up
+        for (int i = 0; i < INC_CLEANUP_ALL_KEYS; i++) {
+            sbetc.setCurrentKey(Integer.toString(i));
+        }
+        // check all state cleaned up
+        for (int i = 0; i < INC_CLEANUP_ALL_KEYS; i++) {
+            sbetc.setCurrentKey(Integer.toString(i));
+            assertTrue("Original state should be cleared", 
ctx().isOriginalNull());

Review comment:
       @Myasuka  Oh.. I see what you mean here. Very good point. :) 
   
   I've improved the codes based on your comments. 




-- 
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to