gortiz commented on code in PR #15180:
URL: https://github.com/apache/pinot/pull/15180#discussion_r1991893933


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/service/dispatch/DispatchClient.java:
##########
@@ -70,7 +71,13 @@ public void submit(Worker.QueryRequest request, 
QueryServerInstance virtualServe
   }
 
   public void cancel(long requestId) {
-    Worker.CancelRequest cancelRequest = 
Worker.CancelRequest.newBuilder().setRequestId(requestId).build();
+    String cid = QueryThreadContext.isInitialized() && 
QueryThreadContext.getCid() != null
+        ? QueryThreadContext.getCid()
+        : Long.toString(requestId);
+    Worker.CancelRequest cancelRequest = Worker.CancelRequest.newBuilder()
+        .setRequestId(requestId)
+        .setCid(cid)
+        .build();

Review Comment:
   Here we are doing the following:
   1. Get the cid or build one using the request id in case it is not present 
in the context. The later is probably not needed, but it makes the code cleaner 
and safer.
   2. The code that builds the CancelRequest has been changed to be closer to 
what is expected in fluent APIs, basically a method per line
   3. We also add the Cid as an attribute
   
   The later is needed to be able to set the cid on the QueryThreadContexts of 
the servers that are going to cancel the query. They don't need the cid to 
cancel the query, but we want to include that in the cancellation logs for sure.



-- 
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-unsubscr...@pinot.apache.org

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


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

Reply via email to