Jackie-Jiang commented on a change in pull request #5169: Table level timeout 
implementation
URL: https://github.com/apache/incubator-pinot/pull/5169#discussion_r396826849
 
 

 ##########
 File path: 
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
 ##########
 @@ -312,8 +313,29 @@ public BrokerResponse handleRequest(JsonNode request, 
@Nullable RequesterIdentit
     long routingEndTimeNs = System.nanoTime();
     _brokerMetrics.addPhaseTiming(rawTableName, 
BrokerQueryPhase.QUERY_ROUTING, routingEndTimeNs - routingStartTimeNs);
 
+    // Set timeout in the requests
+    long timeSpentMs = TimeUnit.NANOSECONDS.toMillis(routingEndTimeNs - 
compilationStartTimeNs);
+    // Remaining time in milliseconds for the server query execution
+    // NOTE: Use the max of offline table remaining time and realtime table 
remaining time for hybrid use case if the
+    //       timeout for them are not configured to be the same. Server side 
will have different remaining time set for
+    //       each table type, and broker should wait for both types to return.
+    long remainingTimeMs = 0;
+    try {
+      if (offlineBrokerRequest != null) {
+        remainingTimeMs = setQueryTimeout(offlineTableName, 
offlineBrokerRequest.getQueryOptions(), timeSpentMs);
+      }
+      if (realtimeBrokerRequest != null) {
+        remainingTimeMs = Math.max(remainingTimeMs,
 
 Review comment:
   IMO, it could be very rare but is legit for some use cases to configure 
offline part to have lower timeout than the realtime part because in general 
offline data has better performance. This is not arbitrary choice though. To 
get the full result, broker has to wait for both parts done before merging the 
result.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

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

Reply via email to