RobertIndie opened a new pull request #12348:
URL: https://github.com/apache/pulsar/pull/12348


   
   
   ### Motivation
   
   Consumers should not perform message ignore checks when consuming messages 
from non-persistent topics.
   Otherwise, it may lead to a case where the message is incorrectly ignored 
when the non-persistent reader(or durable subscription non-persistent consumer) 
reconnects to the broker.
   
   Currently, when the reader of the non-persistent topic has its 
`currentMessageQueue` empty before reconnection, its `startMessageId` is set to 
`lastDequeuedMessageId` after reconnection: 
https://github.com/apache/pulsar/blob/4ae7f6a1b38a003c9fc26844e52771b776bf64bf/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L856
   
    and if we specify `startMessageId` as the default value (-1:-1), it will be 
set to (0:0) after reconnection, thus causes all subsequent messages to be 
ignored:
   
https://github.com/apache/pulsar/blob/4ae7f6a1b38a003c9fc26844e52771b776bf64bf/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L1202
   and for batch messages here:
   
https://github.com/apache/pulsar/blob/4ae7f6a1b38a003c9fc26844e52771b776bf64bf/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java#L1029
   
   ### Modifications
   
   * Remove the message ignore check when the topic of the consumer is 
non-persistent
   
   ### Verifying this change
   
   This change is already covered by existing tests, such as 
*testReaderReconnectAndRead* and *testReaderReconnectAndReadBatchMessages*.
   
   ### Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API: (no)
     - The schema: (no)
     - The default values of configurations: (no)
     - The wire protocol: (no)
     - The rest endpoints: (no)
     - The admin cli options: (no)
     - Anything that affects deployment: (no)
   
   ### Documentation
   
   - [x] no-need-doc 
     
   This is a bug fix.
     
   
   
   


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