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


##########
tools/src/main/java/org/apache/kafka/tools/VerifiableShareConsumer.java:
##########
@@ -573,6 +636,21 @@ 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")
+            .action(store())
+            .required(false)
+            .setDefault("")
+            .type(String.class)
+            .dest("ackPattern")
+            .metavar("ACK-PATTERN")
+            .help("Comma-separated cycle of accept|release|reject|renew 
applied to each consumed record " +
+                "via AcknowledgeType, selected by (record offset % pattern 
length). RENEW re-delivers the " +
+                "same record, so its next delivery advances to the following 
pattern entry instead of " +
+                "renewing again (a pattern of only 'renew' is rejected, since 
it could never resolve). " +
+                "When set, the share consumer is switched to explicit 
acknowledgement mode and requires " +

Review Comment:
   I suggest simplifying the text a bit, such as the final piece which could be 
"When set, the share consumer uses explicit acknowledgement and requires 
--acknowledgement-mode to be 'sync' or 'async'.". I would omit the final 
sentence.



##########
tests/kafkatest/services/kafka/kafka.py:
##########
@@ -786,6 +790,12 @@ def prop_file(self, node):
             override_configs[config_property.UNSTABLE_API_VERSIONS_ENABLE] = 
str(True)
             override_configs[config_property.UNSTABLE_FEATURE_VERSIONS_ENABLE] 
= str(True)
 
+        if self.share_version is not None and int(self.share_version) > 1:
+            # share.version=2 (KIP-1191 DLQ) is above 
ShareVersion.LATEST_PRODUCTION (SV_1), so both

Review Comment:
   ShareVersion.LATEST_PRODUCTION is SV_2 now.



##########
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:
   If `exception` is set, the acknowledgement did not succeed. Should the 
bookkeeping account for this, probably just skipping it unless the 
acknowledgement was successful.



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