dajac commented on code in PR #15237:
URL: https://github.com/apache/kafka/pull/15237#discussion_r1470772511


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/OffsetMetadataManager.java:
##########
@@ -903,6 +906,45 @@ public boolean cleanupExpiredOffsets(String groupId, 
List<Record> records) {
         return allOffsetsExpired.get() && 
!openTransactionsByGroup.containsKey(groupId);
     }
 
+    /**
+     * Remove offsets of the partitions that have been deleted.
+     *
+     * @param topicPartitions   The partitions that have been deleted.
+     * @return The list of tombstones (offset commit) to append.
+     */
+    public List<Record> onPartitionsDeleted(
+        List<TopicPartition> topicPartitions
+    ) {
+        List<Record> records = new ArrayList<>();
+
+        Map<String, List<Integer>> partitionsByTopic = new HashMap<>();
+        topicPartitions.forEach(tp -> partitionsByTopic
+            .computeIfAbsent(tp.topic(), __ -> new ArrayList<>())
+            .add(tp.partition())
+        );
+
+        Consumer<Offsets> delete = offsets -> {

Review Comment:
   I have renames `offsets` to `offsetsToClean` here. I hope it helps to reduce 
the confusion.



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to