You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2023/01/18 01:09:36 UTC

[GitHub] [pinot] 61yao commented on a diff in pull request #10117: [multistage] adding async submission

61yao commented on code in PR #10117:
URL: https://github.com/apache/pinot/pull/10117#discussion_r1072987281


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/service/QueryDispatcher.java:
##########
@@ -86,19 +90,29 @@ public int submit(long requestId, QueryPlan queryPlan, long timeoutMs)
           String host = serverInstance.getHostname();
           int servicePort = serverInstance.getQueryServicePort();
           DispatchClient client = getOrCreateDispatchClient(host, servicePort);
-          Worker.QueryResponse response = client.submit(Worker.QueryRequest.newBuilder().setStagePlan(
+          Future<Worker.QueryResponse> response = client.submit(Worker.QueryRequest.newBuilder().setStagePlan(
                   QueryPlanSerDeUtils.serialize(constructDistributedStagePlan(queryPlan, stageId, serverInstance)))
               .putMetadata(QueryConfig.KEY_OF_BROKER_REQUEST_ID, String.valueOf(requestId))
               .putMetadata(QueryConfig.KEY_OF_BROKER_REQUEST_TIMEOUT_MS, String.valueOf(timeoutMs)).build());
-          if (response.containsMetadata(QueryConfig.KEY_OF_SERVER_RESPONSE_STATUS_ERROR)) {
-            throw new RuntimeException(
-                String.format("Unable to execute query plan at stage %s on server %s: ERROR: %s", stageId,
-                    serverInstance, response));
-          }
+          querySubmitResponse.add(response);
+        }
+      }
+    }
+    while (System.currentTimeMillis() < submissionDeadlineMs) {
+      for (Future<Worker.QueryResponse> future : querySubmitResponse) {
+        if (!future.isDone()) {
+          break;
+          Thread.sleep(100);

Review Comment:
   First of all, adding RPC has nothing to do with blocking stub and aysnc stub.
   
   Second, we shouldn't use busy waiting loop waiting for future result. Can you either chain the future or use latch to wait for the result asynchronously? 
   



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org