poorbarcode commented on code in PR #24722:
URL: https://github.com/apache/pulsar/pull/24722#discussion_r2339461089
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -1878,10 +1878,38 @@ protected synchronized void
updateLedgersIdsComplete(@Nullable LedgerHandle orig
}
}
+ void ledgerAddFailedDueToConcurrentlyModified(final LedgerHandle
currentLedger) {
+ bookKeeper.asyncOpenLedger(currentLedger.getId(), digestType,
config.getPassword(), (rc, lh, ctx) -> {
+ if (rc == Code.OK) {
+ log.warn("[{}] Successfully opened ledger {} to check the last
add confirmed position when the ledger"
+ + " was concurrent modified(it is an unexpected behaviour,
which happens when the load-balancer"
+ + " does not work as expected). The add confirmed position
in memory is {}, and the value"
+ + " stored in metadata store is {}. When you get this log,
the latest several entries may be"
+ + " repeated.", name, lh.getId(),
currentLedger.getLastAddConfirmed(), lh.getLastAddConfirmed());
+ ledgerClosed(currentLedger, lh.getLastAddConfirmed());
+ } else {
+ log.error("[{}] Going to fence the topic because failed opened
ledger {} to check the last add"
+ + " confirmed position when the ledger was concurrent
modified(it is an unexpected behaviour,"
+ + " which happens when the load-balancer does not work
as expected). The add confirmed position"
+ + " in memory is {}, and the error code {}. Fecing the
topic to avoid messages lost.",
Review Comment:
Thanks for the suggestion. I have improved the log.
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -1878,10 +1878,38 @@ protected synchronized void
updateLedgersIdsComplete(@Nullable LedgerHandle orig
}
}
+ void ledgerAddFailedDueToConcurrentlyModified(final LedgerHandle
currentLedger) {
+ bookKeeper.asyncOpenLedger(currentLedger.getId(), digestType,
config.getPassword(), (rc, lh, ctx) -> {
+ if (rc == Code.OK) {
+ log.warn("[{}] Successfully opened ledger {} to check the last
add confirmed position when the ledger"
+ + " was concurrent modified(it is an unexpected behaviour,
which happens when the load-balancer"
+ + " does not work as expected). The add confirmed position
in memory is {}, and the value"
+ + " stored in metadata store is {}. When you get this log,
the latest several entries may be"
+ + " repeated.", name, lh.getId(),
currentLedger.getLastAddConfirmed(), lh.getLastAddConfirmed());
+ ledgerClosed(currentLedger, lh.getLastAddConfirmed());
+ } else {
+ log.error("[{}] Going to fence the topic because failed opened
ledger {} to check the last add"
+ + " confirmed position when the ledger was concurrent
modified(it is an unexpected behaviour,"
+ + " which happens when the load-balancer does not work
as expected). The add confirmed position"
Review Comment:
Removed
--
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]