mattisonchao commented on a change in pull request #13975:
URL: https://github.com/apache/pulsar/pull/13975#discussion_r840381704
##########
File path:
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
##########
@@ -1711,7 +1711,7 @@ public void asyncMarkDelete(final Position position,
Map<String, Long> propertie
long ledgerEntries =
ledger.getLedgerInfo(markDeletePosition.getLedgerId()).get().getEntries();
Long nextValidLedger =
ledger.getNextValidLedger(ledger.getLastConfirmedEntry().getLedgerId());
shouldCursorMoveForward = (markDeletePosition.getEntryId() + 1
>= ledgerEntries)
- && (newPosition.getLedgerId() == nextValidLedger);
+ && (nextValidLedger != null &&
newPosition.getLedgerId() == nextValidLedger);
Review comment:
I think we can check ``nextValidLedger != null`` first and then
```java
(markDeletePosition.getEntryId() + 1 >= ledgerEntries)
&& (newPosition.getLedgerId() == nextValidLedger);
```
Please let me know what you think, thanks~
--
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]