You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2021/02/18 15:56:57 UTC

[pulsar] 03/27: [Issue9507][testclient] add --batch-index-ack for the pulsar-perf (#9521)

This is an automated email from the ASF dual-hosted git repository.

penghui pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit f842a2e298e748cfcf450c6b76a39a96c69d929d
Author: limingnihao <li...@live.com>
AuthorDate: Mon Feb 8 14:21:43 2021 +0800

    [Issue9507][testclient] add --batch-index-ack for the pulsar-perf (#9521)
    
    Fixes #9507
    
    ### Motivation
    
    PIP-45 https://github.com/apache/pulsar/wiki/PIP-54:-Support-acknowledgment-at-batch-index-level introduced batch index level acknowledge but the pulsar-perf client does not support to enable it for the consumer. It's better to allow users to do the performance test for the batch index acknowledgment.
    
    ### Modifications
    
    add --batch-index-ack for the pulsar-perf consume command and keep it as false by default.
    
    (cherry picked from commit efb2089fcd4ca04e4f79bf1930ae6aae42de6446)
---
 .../main/java/org/apache/pulsar/testclient/PerformanceConsumer.java   | 4 ++++
 site2/docs/performance-pulsar-perf.md                                 | 1 +
 2 files changed, 5 insertions(+)

diff --git a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
index 606262e..9a3a371 100644
--- a/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
+++ b/pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
@@ -168,6 +168,9 @@ public class PerformanceConsumer {
         @Parameter(names = {"-ioThreads", "--num-io-threads"}, description = "Set the number of threads to be " +
                 "used for handling connections to brokers, default is 1 thread")
         public int ioThreads = 1;
+    
+        @Parameter(names = {"--batch-index-ack" }, description = "Enable or disable the batch index acknowledgment")
+        public boolean batchIndexAck = false;
     }
 
     public static void main(String[] args) throws Exception {
@@ -323,6 +326,7 @@ public class PerformanceConsumer {
                 .subscriptionType(arguments.subscriptionType)
                 .subscriptionInitialPosition(arguments.subscriptionInitialPosition)
                 .autoAckOldestChunkedMessageOnQueueFull(arguments.autoAckOldestChunkedMessageOnQueueFull)
+                .enableBatchIndexAcknowledgment(arguments.batchIndexAck)
                 .replicateSubscriptionState(arguments.replicatedSubscription);
         if (arguments.maxPendingChuckedMessage > 0) {
             consumerBuilder.maxPendingChuckedMessage(arguments.maxPendingChuckedMessage);
diff --git a/site2/docs/performance-pulsar-perf.md b/site2/docs/performance-pulsar-perf.md
index 2035150..be81eef 100644
--- a/site2/docs/performance-pulsar-perf.md
+++ b/site2/docs/performance-pulsar-perf.md
@@ -128,6 +128,7 @@ The following table lists configuration options available for the `pulsar-perf c
 | subscriber-name | Set the subscriber name prefix. | sub |
 | subscription-type | Set the subscription type. <li> Exclusive <li> Shared <li> Failover <li> Key_Shared | Exclusive |
 | trust-cert-file | Set the path for the trusted TLS certificate file. | <empty string> |
+| batch-index-ack | Enable or disable the batch index acknowledgment. | false |
 
 ### Configurations