3schwartz commented on a change in pull request #11340:
URL: https://github.com/apache/kafka/pull/11340#discussion_r716144435



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java
##########
@@ -1069,6 +1065,37 @@ private void maybeAutoCommitOffsetsSync(Timer timer) {
         }
     }
 
+    private void cleanUpConsumedOffsets(Map<TopicPartition, OffsetAndMetadata> 
willCommitOffsets) {
+
+        if (willCommitOffsets.isEmpty())
+            return;
+
+        Set<String> validTopics = metadata.fetch().topics();
+        Set<TopicPartition> toGiveUpTopicPartitions = new HashSet<>();
+
+        Iterator<Map.Entry<TopicPartition, OffsetAndMetadata>> iterator = 
willCommitOffsets.entrySet().iterator();
+
+        while (iterator.hasNext()) {
+
+            Map.Entry<TopicPartition, OffsetAndMetadata> entry = 
iterator.next();
+
+            if (!validTopics.contains(entry.getKey().topic())) {
+
+                toGiveUpTopicPartitions.add(entry.getKey());
+                iterator.remove();
+            }
+
+        }
+
+        if (toGiveUpTopicPartitions.size() > 0) {
+
+            //Because toGiveUpTopicPartitions may receive 
`UnknownTopicOrPartitionException` when submitting their offsets.
+            //We are prepared to abandon them. The worst effect is that these 
partitions may repeatedly consume some messages
+            log.warn("Synchronous auto-commit of offsets {} will be 
abandoned", toGiveUpTopicPartitions);

Review comment:
       My comment was related to the test - it sounds like you are given up 
offsets but it is partitions - hence I would add the partition word in the 
sentence




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