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

   Fixes #16795
   
   ### Motivation
   
   In class `PersistentDispatcherMultipleConsumers`, there is a variable 
`sendInProgress` that is set to `true` before the `sendMessagesToConsumers` 
method is executed and to `false` after the `sendMessagesToConsumers` method is 
executed, thus making the `readMoreEnties` inaccessible during the 
`sendMessagesToConsumers` method's execution. see: #16812
   
   In subclass `PersistentStreamingDispatcherMultipleConsumers`, when reading 
batch entries, `sendMessagesToConsumer` is called each entry is read, which 
causes the variable `sendInProgress` to be set to `true` and `false` multiple 
times. This results in the method `readMoreEnties` can be accessed when the 
variable `sendInProgress` is set to false when a batch of entries is reading. 
This makes repeat delivery of the message, the error process is as follows:
   
   | step | `consumer-1` | `consumer-2` |
   | --- | --- | --- |
   | 1 | try load messages |  |
   | 2 | peek message from the queue `messagesToRedeliver` | try load messages |
   | 3 | repay messages | peek message from the queue `messagesToRedeliver` |
   | 4 | send message to `consumer-1` | repay messages |
   | 5 |  | send message to `consumer-2` |
   
   
   ### Modifications
   
   Set `sendInProgress` to `false` only after the last entry in a batch of 
messages has been delivered.
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. Please attach the local 
preview screenshots (run `sh start.sh` at `pulsar/site2/website`) to your PR 
description, or else your PR might not get merged. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [x] `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: 
   
   - https://github.com/poorbarcode/pulsar/pull/34
   


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