codelipenghui commented on code in PR #15663: URL: https://github.com/apache/pulsar/pull/15663#discussion_r877636972
########## pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java: ########## @@ -2554,13 +2554,18 @@ public void readEntryFailed(ManagedLedgerException exception, Object ctx) { }, null); return future; } else { - Long ledgerId = ((ManagedCursorContainer) ledger.getCursors()).getSlowestReaderPosition().getLedgerId(); + PositionImpl slowestPosition = ((ManagedCursorContainer) ledger.getCursors()).getSlowestReaderPosition(); + Long ledgerId = slowestPosition.getLedgerId(); + if (((ManagedLedgerImpl) ledger).getLedgersInfo().lastKey().equals(ledgerId)) { + return CompletableFuture.completedFuture(false); + } try { org.apache.bookkeeper.mledger.proto.MLDataFormats.ManagedLedgerInfo.LedgerInfo ledgerInfo = ledger.getLedgerInfo(ledgerId).get(); if (ledgerInfo != null && ledgerInfo.hasTimestamp() && ledgerInfo.getTimestamp() > 0 && ((ManagedLedgerImpl) ledger).getClock().millis() - ledgerInfo.getTimestamp() - > backlogQuotaLimitInSecond * 1000) { + > backlogQuotaLimitInSecond * 1000 && slowestPosition.compareTo( + new PositionImpl(ledgerInfo.getLedgerId(), ledgerInfo.getEntries() - 1)) < 0) { Review Comment: Looks like this is an incorrect behavior here. If we have three ledgers, 0,1,2 and the `slowestPosition` reached the end of ledger 0, but ledger 1 also over the backlog quota limitation, we should return true here. The correct behavior should be if the slowest position reaches the end of a ledger, we should calculate the backlog from the next ledger of the ledger of slowest position -- 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-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org