mattisonchao opened a new issue, #19268:
URL: https://github.com/apache/pulsar/issues/19268

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) 
and found nothing similar.
   
   
   ### Version
   
   all
   
   ### Minimal reproduce step
   
   ```java
   /**
        * This test is used to test the unackedMessage number in the consumer.
        */
       @Test
       public void testDuplicateAcknowledgement() throws PulsarClientException, 
PulsarAdminException {
           final String topicName = 
"persistent://public/default/duplicated-acknowledgement-test";
           @Cleanup
           Producer<byte[]> producer = pulsarClient.newProducer()
                   .topic(topicName)
                   .create();
           @Cleanup
           Consumer<byte[]> consumer1 = pulsarClient.newConsumer()
                   .topic(topicName)
                   .subscriptionName("sub-1")
                   .acknowledgmentGroupTime(0, TimeUnit.SECONDS)
                   .subscriptionType(SubscriptionType.Shared)
                   .subscribe();
           producer.send("1".getBytes(StandardCharsets.UTF_8));
           Message<byte[]> message = consumer1.receive();
           consumer1.acknowledge(message);
           consumer1.acknowledge(message);
           assertEquals(admin.topics().getStats(topicName).getSubscriptions()
                   .get("sub-1").getUnackedMessages(), 0);
       }
   ```
   
   ### What did you expect to see?
   
   `unackedMessages=0`.
   
   ### What did you see instead?
   
   `unackedMessages=-1`.
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] I'm willing to submit a PR!


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