poorbarcode commented on code in PR #24722:
URL: https://github.com/apache/pulsar/pull/24722#discussion_r2342732016


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -1878,6 +1878,18 @@ protected synchronized void 
updateLedgersIdsComplete(@Nullable LedgerHandle orig
         }
     }
 
+    void addEntryFailedDueToConcurrentlyModified(final LedgerHandle 
currentLedger, int rc) {
+        log.error("[{}] Fencing the topic to ensure durability and 
consistency(the current ledger was concurrent"
+                + " modified by a other bookie client, which is not expcted)."
+                + " Current ledger: {}, lastAddConfirmed: {} (the value stored 
may be larger), error coder: {}.",
+                name, currentLedger.getId(), 
currentLedger.getLastAddConfirmed(), rc);
+        // Stop switching ledger and write topic metadata, to avoid messages 
lost. The doc of
+        // LedgerHandle also mentioned this: 
https://github.com/apache/bookkeeper/blob/release-4.17.2/
+        // 
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerHandle.java#L2047-L2048.
+        handleBadVersion(new BadVersionException("Failed opened ledger {} to 
check the last add confirmed"
+                + " position when the ledger was concurrent modified."));

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-unsubscr...@pulsar.apache.org

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

Reply via email to