clintropolis commented on a change in pull request #11643:
URL: https://github.com/apache/druid/pull/11643#discussion_r700118000



##########
File path: 
services/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java
##########
@@ -286,7 +286,7 @@ protected void service(HttpServletRequest request, 
HttpServletResponse response)
   private void broadcastQueryCancelRequest(HttpServletRequest request, Server 
targetServer)
   {
     // send query cancellation to all brokers this query may have gone to
-    // to keep the code simple, the proxy servlet will also send a request to 
the default targetServer.
+    // keep the code simple, the proxy servlet will also send a request to the 
default targetServer.

Review comment:
       these comments just seem to be repeating what the javadoc says, maybe 
just remove them completely?

##########
File path: sql/src/main/java/org/apache/druid/sql/SqlLifecycle.java
##########
@@ -372,15 +383,38 @@ public void after(boolean isDone, Throwable thrown)
   @VisibleForTesting
   public ValidationResult runAnalyzeResources(AuthenticationResult 
authenticationResult)
   {
-    synchronized (lock) {
-      return validate(authenticationResult);
+    return validate(authenticationResult);
+  }
+
+  public Set<Resource> getAuthorizedResources()
+  {
+    assert validationResult != null;
+    return validationResult.getResources();
+  }
+
+  /**
+   * Cancel all native queries associated to this lifecycle.
+   *
+   * This method is thread-safe.
+   */
+  public void cancel()
+  {
+    canceled = true;
+
+    final CopyOnWriteArrayList<String> nativeQueryIds = 
plannerContext.getNativeQueryIds();
+
+    for (String nativeQueryId : nativeQueryIds) {
+      log.debug("canceling native query [%s]", nativeQueryId);
+      queryScheduler.cancelQuery(nativeQueryId);
     }
   }
 
-  public RelDataType rowType()
+  public Optional<RelDataType> rowType()
   {
-    synchronized (lock) {
-      return plannerResult != null ? plannerResult.rowType() : 
prepareResult.getRowType();
+    if (canceled) {
+      return Optional.empty();

Review comment:
       why would being cancelled affect the row type?




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

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to