massakam commented on issue #2666: Specific topic becomes unavailable due to 
failure of cursor recovery
URL: https://github.com/apache/pulsar/issues/2666#issuecomment-425056258
 
 
   If ManagedCursorImpl has been modified as follows, the cursor recovery is 
successfully completed and the topic become available. Is this change 
appropriate?
   ```diff
   --- 
a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
   +++ 
b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
   @@ -353,6 +353,9 @@ public class ManagedCursorImpl implements ManagedCursor {
                }
                position = nextExistingLedger != null ? 
PositionImpl.get(nextExistingLedger, -1) : position;
            }
   +        if (position.compareTo(ledger.getLastPosition()) > 0) {
   +            position = PositionImpl.get(ledger.getLastPosition());
   +        }
            log.info("[{}] Cursor {} recovered to position {}", 
ledger.getName(), name, position);
   
            messagesConsumedCounter = 
-getNumberOfEntries(Range.openClosed(position, ledger.getLastPosition()));
   ```

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to