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

   ### Motivation                                                               
                                                                 
                                                                                
                                                                    
   When the cursor's mark-delete position advances (e.g., via message expiry), 
`readMoreEntries` calls `PendingAcksMap.removeAllUpTo` to remove entries from 
the consumer's pendingAcks without decrementing the consumer's 
`unackedMessages` counter, causing it to be permanently inflated.               
                                                              
                                                                                
                                                                 
   This is especially problematic with batch index level ack enabled: partial 
acks leave residual unacked counts in the counter, and after `removeAllUpTo` 
removes the entry from pendingAcks, subsequent individual batch acks can no 
longer find the entry to decrement, so the counter never reaches zero.          
                                                             
                                                                                
                                                                    
   ### Modifications                                                            
                                                                 
                                                                                
                                                                 
   - `PendingAcksMap.removeAllUpTo` accepts a callback invoked per removed 
entry                                                                 
   - `Consumer.removePendingAcksUpToAndCountUnacked` computes the remaining 
unacked count per entry (respecting batch index level ack) and decrements the 
counter                                                                         
                                                        
   - `PersistentDispatcherMultipleConsumers.readMoreEntries` uses the new 
method instead of directly calling `removeAllUpTo`    


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