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 2018/09/28 11:42:54 UTC

[GitHub] massakam opened a new pull request #2673: Avoid problem that topic becomes unavailable due to failure of cursor…

massakam opened a new pull request #2673: Avoid problem that topic becomes unavailable due to failure of cursor…
URL: https://github.com/apache/pulsar/pull/2673
 
 
   … recovery
   
   ### Motivation
   
   This is a change to avoid https://github.com/apache/pulsar/issues/2666.
   
   If a topic is under the following condition and the broker is restarted, that topic becomes unavailable and we can not send or receive messages.
   
   - The managed ledger contains two ledgers and the newer ledger is empty
   ```
   ledgerInfo {
     ledgerId: 65425
     entries: 2
     size: 238
     timestamp: 1506510325426
   }
   ledgerInfo {
     ledgerId: 1952728
     timestamp: 0
   }
   ```
   - `cursorsLedgerId` included in the managed cursor info is -1
   - `markDeleteLedgerId` is between the two ledgers contained in the managed ledger
   ```
   cursorsLedgerId: -1
   markDeleteLedgerId: 1952575
   markDeleteEntryId: -1
   ```
   
   This is because `position` gets ahead of the last position of the managed ledger, and `IllegalArgumentException` occurs in the following line.
   https://github.com/apache/pulsar/blob/d5e88c1ec16df557655e42c9f648a2fd3343d759/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java#L358
   
   ### Modifications
   
   If `position` gets ahead of the last position of the managed ledger when recovering the cursor, `position` is adjusted to the last position.
   
   ### Result
   
   Even a topic with metadata as described above, the cursor will be recovered successfully.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services