hachikuji commented on a change in pull request #8657:
URL: https://github.com/apache/kafka/pull/8657#discussion_r427430032



##########
File path: core/src/main/scala/kafka/coordinator/group/GroupCoordinator.scala
##########
@@ -369,6 +369,31 @@ class GroupCoordinator(val brokerId: Int,
     }
   }
 
+  /**
+   * try to complete produce, fetch and delete requests if the HW of partition 
is incremented. Otherwise, we try to complete
+   * only delayed fetch requests.
+   *
+   * Noted that this method may hold a lot of group lock so the caller should 
NOT hold any group lock
+   * in order to avoid deadlock
+   * @param topicPartitions topic partition and leaderHWIncremented
+   */
+  private[this] def completeDelayedRequests(topicPartitions: 
Map[TopicPartition, Boolean]): Unit =
+    topicPartitions.foreach {
+      case (tp, leaderHWIncremented) =>
+        if (leaderHWIncremented) 
groupManager.replicaManager.completeDelayedRequests(tp)
+        else groupManager.replicaManager.completeDelayedFetchRequests(tp)
+    }
+
+  /**
+   * complete the delayed join requests associated to input group keys.
+   *
+   * Noted that this method may hold a lot of group lock so the caller should 
NOT hold any group lock
+   * in order to avoid deadlock
+   * @param groupKeys group keys to complete
+   */
+  private[this] def completeDelayedJoinRequests(groupKeys: Set[GroupKey]): 
Unit =
+    groupKeys.foreach(joinPurgatory.checkAndComplete)

Review comment:
       The join/heartbeat purgatories are a little different from the produce 
purgatory. The key is based on the groupId, so when we complete an operation 
for group "foo," we won't complete for group "bar" incidentally. At least that 
is my understanding. If you look at 
`DelayedOperationPurgatory.checkAndComplete`, we only complete watchers for the 
passed key.




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

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


Reply via email to