clintropolis commented on code in PR #20460:
URL: https://github.com/apache/druid/pull/20460#discussion_r4189972583


##########
processing/src/main/java/org/apache/druid/frame/processor/FrameProcessorExecutor.java:
##########
@@ -666,13 +703,26 @@ private void cancel(final Set<FrameProcessor<?>> 
processorsToCancel)
     }
   }
 
-  private <T> void registerCancelableProcessor(final FrameProcessor<T> 
processor, @Nullable final String cancellationId)
+  /**
+   * Register a processor so {@link #cancel(String)} can find it.
+   *
+   * @return true if registered, or if there is no cancellationId to register 
under. False if {@code cancellationId}
+   * is already canceled, in which case the caller must not run the processor 
and owns cleaning it up.
+   */
+  private <T> boolean registerCancelableProcessor(
+      final FrameProcessor<T> processor,
+      @Nullable final String cancellationId
+  )
   {
     if (cancellationId != null) {
       synchronized (lock) {
+        if (!activeCancellationIds.contains(cancellationId)) {

Review Comment:
   yea, this cannot happen right now because nothing re-uses cancel id. I guess 
it could if something ever did try to do this, however I also can't think of a 
great case for doing such a thing, it would have to be something like a retry 
that re-uses the executor I guess? I think i'll just add javadoc as @capistrant 
suggests to mention that re-using cancellationId is not supported and we can 
fix the problem if something ever does need to do that.



-- 
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