This is an automated email from the ASF dual-hosted git repository.

JingsongLi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new ee1515fe5f [test] Bound the level 0 compaction wait in 
PrimaryKeyFileStoreTableITCase (#8940)
ee1515fe5f is described below

commit ee1515fe5ff7f1937eafba0422652f5d229869e5
Author: Vova Kolmakov <[email protected]>
AuthorDate: Thu Jul 30 22:01:21 2026 +0700

    [test] Bound the level 0 compaction wait in PrimaryKeyFileStoreTableITCase 
(#8940)
---
 .../flink/PrimaryKeyFileStoreTableITCase.java      | 23 +++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git 
a/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/PrimaryKeyFileStoreTableITCase.java
 
b/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/PrimaryKeyFileStoreTableITCase.java
index c381d99f83..87d1113816 100644
--- 
a/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/PrimaryKeyFileStoreTableITCase.java
+++ 
b/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/PrimaryKeyFileStoreTableITCase.java
@@ -62,6 +62,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.TimeoutException;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -1659,13 +1660,29 @@ public class PrimaryKeyFileStoreTableITCase extends 
AbstractTestBase {
         if (table.coreOptions().needLookup()) {
             // if table needs lookup, batch query will not get data on level = 
0,
             // so we need to wait until all level 0 are compacted
+            long timeoutMs = TIMEOUT * 1000L;
+            long deadline = System.currentTimeMillis() + timeoutMs;
             while (true) {
+                int remaining = 0;
                 try (CloseableIterator<Row> it =
-                        bEnv.executeSql("SELECT * FROM `T$files` WHERE level = 
0").collect()) {
-                    if (!it.hasNext()) {
-                        break;
+                        collect(bEnv.executeSql("SELECT * FROM `T$files` WHERE 
level = 0"))) {
+                    while (it.hasNext()) {
+                        it.next();
+                        remaining++;
                     }
                 }
+                if (remaining == 0) {
+                    break;
+                }
+                // bound this wait: if compaction never finishes, @Timeout 
cannot interrupt the
+                // loop reliably, so an unbounded wait hangs the whole CI job 
until the workflow
+                // timeout instead of failing here
+                if (System.currentTimeMillis() >= deadline) {
+                    throw new TimeoutException(
+                            String.format(
+                                    "%d level 0 file(s) are still not 
compacted after %d seconds.",
+                                    remaining, timeoutMs / 1000));
+                }
                 Thread.sleep(500);
             }
         }

Reply via email to