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


##########
tools/src/main/java/org/apache/kafka/tools/VerifiableShareConsumer.java:
##########
@@ -392,6 +408,12 @@ private void onRecordsReceived(ConsumerRecords<String, 
String> records) {
 
             for (ConsumerRecord<String, String> record : partitionRecords) {
                 partitionOffsets.add(record.offset());
+
+                if (!ackPattern.isEmpty()) {
+                    AcknowledgeType type = ackPattern.get((int) 
(record.offset() % ackPattern.size()));

Review Comment:
   What happens if `ackPattern` contains `RENEW`?



##########
tools/src/main/java/org/apache/kafka/tools/VerifiableShareConsumer.java:
##########
@@ -410,10 +432,27 @@ 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) {
+                TopicPartition topicPartition = new TopicPartition(tp.topic(), 
tp.partition());
+                Map<Long, AcknowledgeType> offsetTypes = 
pendingAckTypes.get(topicPartition);
+                if (offsetTypes != null) {
+                    for (Long offset : offsetEntry.getValue()) {

Review Comment:
   `Long` -> `long`



##########
tools/src/main/java/org/apache/kafka/tools/VerifiableShareConsumer.java:
##########
@@ -573,6 +612,19 @@ private static ArgumentParser argParser() {
             .metavar("ACKNOWLEDGEMENT-MODE")
             .help("Acknowledgement mode for the share consumers (must be 
either 'auto', 'sync' or 'async')");
 
+        parser.addArgument("--ack-pattern")

Review Comment:
   Should we add those new options to KIP-1191? Or is it fine since this is a 
test class?



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