junrao commented on code in PR #17842:
URL: https://github.com/apache/kafka/pull/17842#discussion_r1846960975


##########
server-common/src/main/java/org/apache/kafka/server/purgatory/DelayedOperationPurgatory.java:
##########
@@ -105,8 +105,8 @@ private WatcherList watcherList(DelayedOperationKey key) {
      * <br/>
      * Note that a delayed operation can be watched on multiple keys. It is 
possible that
      * an operation is completed after it has been added to the watch list for 
some, but
-     * not all the keys. In this case, the operation is considered completed 
and won't
-     * be added to the watch list of the remaining keys. The expiration reaper 
thread will
+     * not all the keys. In this case, although the operation will be added 
for the remaining keys, it is considered
+     * completed and won't be watched for the remaining keys. The expiration 
reaper thread will

Review Comment:
   > won't be watched for the remaining keys
   
   The code doesn't do that though. In the following, `watchForOperation` 
doesn't check if the operation is completed or not. So, we need to either 
change the code or the comment.
   
   ```
           if (operation.safeTryCompleteOrElse(() -> {
               watchKeys.forEach(key -> watchForOperation(key, operation));
               if (!watchKeys.isEmpty())
                   estimatedTotalOperations.incrementAndGet();
           })) {
               return true;
           }
   
   ```



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

Reply via email to