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

   ### Motivation
   
   #15204 
   
   In the current implementation, When the first time execute 
`purgeInactiveProducers`, Although the produces does not expire, it removed 
directly from the collection(464 line). The will result in these producers 
never being remove.
   
   
https://github.com/apache/pulsar/blob/9861dfb1208c4b6b8a1f17ef026e9af71c3e784c/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/MessageDeduplication.java#L454-L472
   
   ### Modifications
   
   1. It is removed from the collection only when the producer is inactive.
   2. Take a snapshot after each removal of an inactive producer. When 
`managedLedger.getLastConfirmedEntry` equals 
`managedCursor.getMarkDeletedPosition()`, The`deduplication-snapshot-monitor` 
thread does not trigger a snapshot. The persistence these producers only the 
next time a message is produced, The can be confusing for users.
   
   ```
           PositionImpl position = (PositionImpl) 
managedLedger.getLastConfirmedEntry();
           if (position == null) {
               return;
           }
           PositionImpl markDeletedPosition = (PositionImpl) 
managedCursor.getMarkDeletedPosition();
           if (markDeletedPosition != null && 
position.compareTo(markDeletedPosition) <= 0) {
               return;
           }
   ```
   
   
   
   ### Documentation
   - [x] `no-need-doc` 
   


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