Technoboy- commented on code in PR #15663:
URL: https://github.com/apache/pulsar/pull/15663#discussion_r878198902


##########
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:
   fixed.



-- 
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]

Reply via email to