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

   ### Motivation
   
   **Background**
   The steps for checking backlog metadata are as follows
   - Get the oldest cursor
   - Return the result if the oldest `cursor.md` equals LAC
   - Else, calculate the estimated backlog quota
   
   **Issue**
   - The method `PersistentTopic.estimatedTimeBasedBacklogQuotaCheck` may get 
an NPE when the `@param position(cursor.markDeletedPositon)` equals LAC and the 
latest ledger has been removed by a `ML.trimLedgers`, which was introduced by 
https://github.com/apache/pulsar/pull/21816
   - Q: The broker checked whether the oldest `cursor.md` equals LAC at step 2 
above, why does it still call 
`PersistentTopic.estimatedTimeBasedBacklogQuotaCheck` with a param that equals 
`LAC`?
     - A: There may be some `acknowledgments` and `ML.trimLedgers` happened 
between `step2 above and step 3` above
   
   ### Modifications
   
   - Fix NPE, and let the logic is the same as the behavior before 
https://github.com/apache/pulsar/pull/21816
   
   
   ### 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 -->
   - [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: x
   


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