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

   ### Motivation
   
   **The reproduction steps of the issue:**
   - There are `4` ledgers in the ManagedLedger
   - `3` ledgers are offloaded.
   - The BK ledgers are deleted because they were offloaded.
   - Issue:
     - Actual behavior: `ManagedLedger.getLedgerHandle(long ledgerId)` returns 
BK ledger handles, which have been deleted
     - Expected behavior: `ManagedLedger.getLedgerHandle(long ledgerId)` 
returns Offloader ledger handles.
   
   **Root cause**
   Trimming ledgers, BK ledgers are deleted, and `LedgerCache` of 
`ManagedLedger` does not remove the cached ledger handle in memory.
   
   ### Modifications
   
   - In scope: Remove cached ledger handles when trimming offloaded ledgers.
   - Not in scope: This PR will not solve the issue: Ledger is being deleted, 
but a cursor still uses the ledger handle to read entries. This issue will be 
resolved automatically because ManagedLedger will recreate the ledger handle 
when it receives a failed read entry callback 
   
   ### 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