sjhajharia commented on code in PR #22786:
URL: https://github.com/apache/kafka/pull/22786#discussion_r3594460465


##########
tools/src/main/java/org/apache/kafka/tools/VerifiableShareConsumer.java:
##########
@@ -410,10 +445,38 @@ private void onRecordsReceived(ConsumerRecords<String, 
String> records) {
     public void onComplete(Map<TopicIdPartition, Set<Long>> offsetsMap, 
Exception exception) {
         List<AcknowledgedData> acknowledgedOffsets = new ArrayList<>();
         int totalAcknowledged = 0;
+        Map<String, Long> ackTypeCounts = (ackPattern.isEmpty() || exception 
!= null) ? null : new HashMap<>();
         for (Map.Entry<TopicIdPartition, Set<Long>> offsetEntry : 
offsetsMap.entrySet()) {
             TopicIdPartition tp = offsetEntry.getKey();
             acknowledgedOffsets.add(new AcknowledgedData(tp.topic(), 
tp.partition(), offsetEntry.getValue()));
             totalAcknowledged += offsetEntry.getValue().size();
+
+            if (ackTypeCounts != null) {

Review Comment:
   `ackTypeCounts` is `null` when `exception != null` (line 448), so this whole 
block is already skipped on failure. I think that should take care of the same?



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