You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/05/20 14:19:08 UTC

[GitHub] [pulsar] Technoboy- commented on a diff in pull request #15663: [fix][broker] Fix creating producer failure when set backlog quota.

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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org