poorbarcode commented on code in PR #24722:
URL: https://github.com/apache/pulsar/pull/24722#discussion_r2342734436
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java:
##########
@@ -361,7 +361,16 @@ void handleAddFailure(final LedgerHandle lh) {
finalMl.getExecutor().execute(() -> {
// Force the creation of a new ledger. Doing it in a background
thread to avoid acquiring ML lock
// from a BK callback.
+ // If we received a "MetadataVersionException" or a
"LedgerFencedException", we should tell the ML that
+ // the ledger has been closed by others, and the entries count in
the ledger may is not correct. The ML
+ // will handle it.
finalMl.ledgerClosed(lh);
+ if (rc != null && (rc.intValue() ==
BKException.Code.MetadataVersionException
+ || rc.intValue() ==
BKException.Code.LedgerFencedException)) {
+ finalMl.addEntryFailedDueToConcurrentlyModified(lh, rc);
+ } else {
+ finalMl.ledgerClosed(lh);
+ }
Review Comment:
Sorry, I added the line-367 for test and forgot to remove it
--
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]