You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/06/07 02:20:47 UTC

[GitHub] [pulsar] mattisonchao commented on pull request #15837: [Fix][broker] Fix NPE when ledger id not found in `OpReadEntry`

mattisonchao commented on PR #15837:
URL: https://github.com/apache/pulsar/pull/15837#issuecomment-1148120928

   After discussing with @Technoboy-, we may find why the `ledgers.ceilingKey` get `Null`; please consider this condition:
   
   ### Precondition
   
   - We have a ledger 12222:-1 at the `ManagedLedger` `ledgers`.
   - We have an inactive cursor that read position is `12222:0`.
   
   ### Cases
   
   1. When a new producer wants to produce a message on the topic but adds an entry to BK failed. It will prepare to close the current ledger and create a new one. because the current ledger entries are 0. So, we decided to delete it immediately. The logic shows below: 
   
   https://github.com/apache/pulsar/blob/5455f4ddd0ff7b67b728958f7a52cb665a73c20e/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L1618-L1659
   
   **After line:1643, we may have open ledgers now.**
        
   2. At mealtimes, the new subscription wants to read messages and create the `OpReadEntry`. but the `ledgers` are empty then NPE occur at `startReadOperationOnLedger` method.
   
   
   /cc @Technoboy-  @codelipenghui 


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org