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

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

commit ecbfcdca5246ebf66eea7907e725e85540188f89
Author: fengyubiao <[email protected]>
AuthorDate: Fri Sep 30 17:32:55 2022 +0800

    [fix][flaky-test]NegativeAcksTest.testNegativeAcksWithBatchAckEnabled 
(#17893)
    
    Fixes: #16864
    
    ### Motivation
    
    I think it is a wrong configuration(`ackTimeout 1s`) when writing the code, 
the original design is set `negativeAckRedeliveryDelay 1s`
    
    The process expects:
    
    - send 10 messages in one batch
      - submit a batch.
    - receive 10 messages, do negative acknowledge
    - after `1s`, will trigger `redelivery`
    - receive 10 messages again
    
    The real process:
    - send 1 message
      - Reach the batch time limit, and submit a batch. return `msgId_1`
    - send 9 messages in another batch
      - submit a batch. return `msgId_2`
    - receive 10 messages, do negative acknowledge
      - push the `msgId_1` to `negativeAcksTracker`
      - push the `msgId_2` to `unAckedMessageTracker`
    - after `1s`, will trigger redelivery `msgId_2` by `unAckedMessageTracker`
    - receive 9 messages( `msgId_2` ) again
    - after `60s`, will trigger redelivery `msgId_1` by `negativeAcksTracker`. 
<strong>(High light)</strong> Test execution timeout!
    - receive 1 messages( `msgId_1` ) again
    
    ### Modifications
    
    - remove conf: `ackTimeout`
    - set `negativeAckRedeliveryDelay 1s`
    
    ### Documentation
    
    - [x] `doc-not-needed`
    
    ### Matching PR in forked repository
    
    PR in forked repository:
    
    - https://github.com/poorbarcode/pulsar/pull/18
    
    (cherry picked from commit 85b1138593a49a29c269266ca3bc1692b00f0971)
---
 .../src/test/java/org/apache/pulsar/client/impl/NegativeAcksTest.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/NegativeAcksTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/NegativeAcksTest.java
index a25c4dee242..ea3b53b46a7 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/NegativeAcksTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/NegativeAcksTest.java
@@ -329,7 +329,7 @@ public class NegativeAcksTest extends ProducerConsumerBase {
                 .acknowledgmentGroupTime(0, TimeUnit.SECONDS)
                 .subscriptionType(SubscriptionType.Shared)
                 .enableBatchIndexAcknowledgment(true)
-                .ackTimeout(1000, TimeUnit.MILLISECONDS)
+                .negativeAckRedeliveryDelay(1, TimeUnit.SECONDS)
                 .subscribe();
 
         @Cleanup

Reply via email to