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

Jackie-Jiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 5b2566467f5 Fix offline upsert integration test readiness (#20282)
5b2566467f5 is described below

commit 5b2566467f5094487702c6d06a2ecdcee669f1a0
Author: Xiaotian (Jackie) Jiang <[email protected]>
AuthorDate: Tue Nov 17 16:00:04 2026 -0800

    Fix offline upsert integration test readiness (#20282)
---
 .../tests/custom/OfflineUpsertTableTest.java       | 36 +++++++++++++---------
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git 
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/OfflineUpsertTableTest.java
 
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/OfflineUpsertTableTest.java
index 104b80d9b06..61963f09f42 100644
--- 
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/OfflineUpsertTableTest.java
+++ 
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/OfflineUpsertTableTest.java
@@ -19,10 +19,12 @@
 package org.apache.pinot.integration.tests.custom;
 
 import java.io.File;
+import java.time.Duration;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.pinot.client.ResultSet;
 import org.apache.pinot.common.utils.TarCompressionUtils;
 import org.apache.pinot.common.utils.config.TagNameUtils;
@@ -143,13 +145,7 @@ public class OfflineUpsertTableTest extends 
CustomDataQueryClusterIntegrationTes
   @Override
   protected void waitForAllDocsLoaded(long timeoutMs)
       throws Exception {
-    TestUtils.waitForCondition(aVoid -> {
-      try {
-        return queryCountStarWithoutUpsert() == TOTAL_RAW_RECORDS;
-      } catch (Exception e) {
-        return null;
-      }
-    }, 100L, timeoutMs, "Failed to load all documents");
+    waitForAllDocsLoaded(TOTAL_RAW_RECORDS, timeoutMs);
     assertEquals(getCurrentCountStarResult(), getCountStarResult());
   }
 
@@ -199,13 +195,7 @@ public class OfflineUpsertTableTest extends 
CustomDataQueryClusterIntegrationTes
     buildSegment(tableConfig, schema, "segment_update_0", rows, newSegmentDir, 
newTarDir);
     uploadSegments(TABLE_NAME, newTarDir);
 
-    TestUtils.waitForCondition(aVoid -> {
-      try {
-        return queryCountStarWithoutUpsert() == TOTAL_RAW_RECORDS + 1;
-      } catch (Exception e) {
-        return null;
-      }
-    }, 100L, 600_000L, "Failed to load updated segment");
+    waitForAllDocsLoaded(TOTAL_RAW_RECORDS + 1, 600_000L);
 
     assertEquals(getCurrentCountStarResult(), UNIQUE_PRIMARY_KEYS);
 
@@ -215,6 +205,24 @@ public class OfflineUpsertTableTest extends 
CustomDataQueryClusterIntegrationTes
     assertEquals(rs.getFloat(0, 0), 9999.0f, 0.01f);
   }
 
+  private void waitForAllDocsLoaded(int expectedRawRecords, long timeoutMs) {
+    int numServers = getSharedServerStarters().size();
+    AtomicInteger consecutiveSuccesses = new AtomicInteger();
+    TestUtils.waitForCondition(() -> {
+      try {
+        if (queryCountStarWithoutUpsert() != expectedRawRecords) {
+          consecutiveSuccesses.set(0);
+          return false;
+        }
+        return consecutiveSuccesses.incrementAndGet() >= numServers;
+      } catch (Exception e) {
+        consecutiveSuccesses.set(0);
+        throw e;
+      }
+    }, 100L, timeoutMs, "Failed to load " + expectedRawRecords + " documents 
on all servers",
+        Duration.ofMillis(timeoutMs / 10));
+  }
+
   private void buildAndUploadTestSegments(TableConfig tableConfig, Schema 
schema)
       throws Exception {
     List<GenericRow> segment1Rows = new ArrayList<>();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to