cshuo commented on code in PR #17677:
URL: https://github.com/apache/hudi/pull/17677#discussion_r2644560088


##########
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/sink/compact/ITTestHoodieFlinkCompactor.java:
##########
@@ -313,9 +315,7 @@ public void testHoodieFlinkCompactorService(boolean 
enableChangelog) throws Exce
     HoodieFlinkCompactor.AsyncCompactionService asyncCompactionService = new 
HoodieFlinkCompactor.AsyncCompactionService(cfg, conf);
     asyncCompactionService.start(null);
 
-    // wait for the asynchronous commit to finish
-    TimeUnit.SECONDS.sleep(10);
-
+    TestUtils.waitUntil(() -> 
TestUtils.getLastCompleteInstant(tempFile.getAbsolutePath(), 
HoodieTimeline.COMMIT_ACTION) != null, 20);

Review Comment:
   fixed.



##########
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/utils/TestUtils.java:
##########
@@ -157,4 +159,14 @@ public static String 
amendCompletionTimeToLatest(HoodieTableMetaClient metaClien
     Files.move(sourcePath, newFilePath);
     return newCompletionTime;
   }
+
+  public static boolean waitUntil(BooleanSupplier condition, int 
timeoutSeconds) throws InterruptedException {
+    for (int i = 0; i < timeoutSeconds; i++) {
+      if (condition.getAsBoolean()) {
+        return true;
+      }
+      TimeUnit.SECONDS.sleep(1);
+    }
+    return false;
+  }

Review Comment:
   fixed



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