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


##########
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:
   took some time to look at this and I just don't see what could actually run 
into this in the existing implementation. Maybe it is a proactive suggestion? 
If that is the case are we better off updating the javadoc for 
`registerCancellationId` to prevent future callers from re-registering with an 
id they are re-using?



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