poorbarcode commented on code in PR #21248:
URL: https://github.com/apache/pulsar/pull/21248#discussion_r1337147663
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -3633,12 +3633,19 @@ public boolean isValidPosition(PositionImpl position) {
log.debug("IsValid position: {} -- last: {}", position, last);
}
- if (position.getEntryId() < 0) {
+ if (!ledgers.containsKey(position.getLedgerId())){
return false;
- } else if (position.getLedgerId() > last.getLedgerId()) {
+ } else if (position.getEntryId() < 0) {
return false;
+ } else if (position.getLedgerId() > last.getLedgerId() &&
position.getLedgerId() != currentLedger.getId()) {
+ return false;
Review Comment:
The answer is
[below](https://github.com/apache/pulsar/pull/21248#discussion_r1337131858)
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -3633,12 +3633,19 @@ public boolean isValidPosition(PositionImpl position) {
log.debug("IsValid position: {} -- last: {}", position, last);
}
- if (position.getEntryId() < 0) {
+ if (!ledgers.containsKey(position.getLedgerId())){
return false;
- } else if (position.getLedgerId() > last.getLedgerId()) {
+ } else if (position.getEntryId() < 0) {
return false;
+ } else if (position.getLedgerId() > last.getLedgerId() &&
position.getLedgerId() != currentLedger.getId()) {
+ return false;
+ } else if (position.getLedgerId() == currentLedger.getId()) {
+ return position.getEntryId() <= currentLedgerEntries;
+ } else if (position.getLedgerId() == currentLedger.getId()) {
+ return position.getEntryId() <= currentLedgerEntries;
Review Comment:
> Are they duplicated?
Fixed.
> Same comment as the above one. Any position greater than the last added
confirmed entry should be an invalid position.
The answer is
[below](https://github.com/apache/pulsar/pull/21248#discussion_r1337131858)
--
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]