rdhabalia opened a new pull request, #23345:
URL: https://github.com/apache/pulsar/pull/23345

   ### Motivation
   
   Currently, Pulsar-client lib doesn't increase the permits for the 
failover/exclusive consumer if it has listener and if that consumer has to 
filter out the messages because of incorrect epoch time. Because of that 
message listener will eventually stop consuming messages as you can see below 
that consumer doesn't have availablePermit and broker stops dispatching the 
messages, even if consumer has processed all sent messages by the broker.
   
   ```
   stats
   
   subscriptions" : {
   "activeConsumerName" : "f8051",
   :
   "consumers" : [ {
           "msgRateOut" : 0.0,
           "msgThroughputOut" : 0.0,
           "bytesOutCounter" : 3623009,
           "msgOutCounter" : 6752,
           "msgRateRedeliver" : 0.0,
           "messageAckRate" : 0.0,
           "chunkedMessageRate" : 0.0,
           "consumerName" : "f8051",
           "availablePermits" : -2,
   
   
   stats-internal
   
   
   cursors" : {
       "my-failover-sub" : {
         "markDeletePosition" : "4748166582:37897",
         "readPosition" : "4748166582:37898",
   
   
   18:52:18.473 [pulsar-client-internal-1003-1] WARN  
org.apache.pulsar.client.impl.ConsumerBase - Consumer filter old epoch message, 
topic : [persistent://myProp/ns1/t1], messageId : [4748166582:37897:23], 
messageConsumerEpoch : [4], consumerEpoch : [5]  yrid: 
   18:52:18.476 [pulsar-client-internal-1003-1] DEBUG 
org.apache.pulsar.client.impl.MultiTopicsConsumerImpl - 
[persistent://myProp/ns1/t1][my-failover-sub] Received message from 
topics-consumer 4748166582:37897:23
   18:52:18.823 [pulsar-external-listener-863-1] DEBUG 
org.apache.pulsar.client.impl.ConsumerBase - 
[persistent://myProp/ns1/t1][my-failover-sub] Calling message listener for 
message 4748166582:37897:23
   ```
   
   ### Modifications
   
   Pulsar consumer should increase permits if it discard messages due to epoch 
mismatch and continue processing messages with correct epoch.
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe 
tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads 
(10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Does this pull request potentially affect one of the following parts:
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   *If the box was checked, please highlight the changes*
   
   - [ ] Dependencies (add or upgrade a dependency)
   - [ ] The public API
   - [ ] The schema
   - [ ] The default values of configurations
   - [ ] The threading model
   - [ ] The binary protocol
   - [ ] The REST endpoints
   - [ ] The admin CLI options
   - [ ] The metrics
   - [ ] Anything that affects deployment
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: <!-- ENTER URL HERE -->
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions 
will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since 
the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed 
in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments 
have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


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