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 21659399a48 Wait for query server readiness in failure detector test 
(#20454)
21659399a48 is described below

commit 21659399a48356cc83f1086de9970ecfdd690945
Author: Xiaotian (Jackie) Jiang <[email protected]>
AuthorDate: Fri Dec 4 14:51:54 2026 -0800

    Wait for query server readiness in failure detector test (#20454)
---
 ...ionBrokerRequestHandlerFailureDetectorTest.java | 34 +++++++++++++++-------
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git 
a/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/SingleConnectionBrokerRequestHandlerFailureDetectorTest.java
 
b/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/SingleConnectionBrokerRequestHandlerFailureDetectorTest.java
index 28e94e36e98..235e4abfcd0 100644
--- 
a/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/SingleConnectionBrokerRequestHandlerFailureDetectorTest.java
+++ 
b/pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/SingleConnectionBrokerRequestHandlerFailureDetectorTest.java
@@ -70,6 +70,7 @@ import org.testng.annotations.Test;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
 
 
@@ -205,15 +206,15 @@ public class 
SingleConnectionBrokerRequestHandlerFailureDetectorTest {
 
   /// Starts a server that answers queries straight away.
   private ServerInstance startRespondingServer(int port) {
-    DataTable dataTable = DataTableBuilderFactory.getEmptyDataTable();
-    dataTable.getMetadata().put(MetadataKey.REQUEST_ID.getName(), 
Long.toString(REQUEST_ID));
-    DataBuffer response;
-    try {
-      response = dataTable.toDataBuffer();
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-    return startQueryServer(port, queryRequest -> 
Futures.immediateFuture(response));
+    return startQueryServer(port, queryRequest -> {
+      DataTable dataTable = DataTableBuilderFactory.getEmptyDataTable();
+      dataTable.getMetadata().put(MetadataKey.REQUEST_ID.getName(), 
Long.toString(queryRequest.getRequestId()));
+      try {
+        return Futures.immediateFuture(dataTable.toDataBuffer());
+      } catch (IOException e) {
+        return Futures.immediateFailedFuture(e);
+      }
+    });
   }
 
   private ServerInstance startQueryServer(int port,
@@ -244,7 +245,13 @@ public class 
SingleConnectionBrokerRequestHandlerFailureDetectorTest {
 
   private SingleConnectionBrokerRequestHandler.ScatterResult 
scatter(TableRouteInfo route)
       throws Exception {
-    return _requestHandler.doScatter(REQUEST_ID, RAW_TABLE_NAME, route, 
QUERY_TIMEOUT_MS,
+    return scatter(REQUEST_ID, route, QUERY_TIMEOUT_MS);
+  }
+
+  private SingleConnectionBrokerRequestHandler.ScatterResult scatter(long 
requestId, TableRouteInfo route,
+      long timeoutMs)
+      throws Exception {
+    return _requestHandler.doScatter(requestId, RAW_TABLE_NAME, route, 
timeoutMs,
         new BaseSingleStageBrokerRequestHandler.ServerStats());
   }
 
@@ -439,6 +446,13 @@ public class 
SingleConnectionBrokerRequestHandlerFailureDetectorTest {
     ServerInstance frozenServer2 = startFrozenServer();
     ServerInstance respondingServer = startRespondingServer(0);
 
+    // Binding the socket does not warm up the query path. Complete a setup 
query before testing the short deadline,
+    // using a separate request ID so a late setup response cannot satisfy the 
query under test.
+    SingleConnectionBrokerRequestHandler.ScatterResult warmup =
+        scatter(REQUEST_ID + 1, offlineRouteTo(respondingServer), 10_000L);
+    assertFalse(warmup.isTimedOut());
+    assertEquals(warmup.getDataTableMap().size(), 1);
+
     SingleConnectionBrokerRequestHandler.ScatterResult result =
         scatter(offlineRouteTo(frozenServer1, frozenServer2, 
respondingServer));
     assertTrue(result.isTimedOut());


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

Reply via email to