hangc0276 commented on a change in pull request #12015:
URL: https://github.com/apache/pulsar/pull/12015#discussion_r753774077
##########
File path:
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
##########
@@ -1466,6 +1452,20 @@ public void operationFailed(MetaStoreException e) {
metadataMutex.unlock();
+ if (e instanceof BadVersionException) {
+ synchronized (ManagedLedgerImpl.this) {
+ log.error(
+ "[{}] Failed to update ledger list. z-node
version mismatch. Closing managed ledger",
+ name);
+ STATE_UPDATER.set(ManagedLedgerImpl.this,
State.Fenced);
+ // Return ManagedLedgerFencedException to
addFailed callback
+ // to indicate that the ledger is now fenced and
topic needs to be closed
+ clearPendingAddEntries(new
ManagedLedgerFencedException(e));
+ // Do not need to unlock ledgersListMutex here
because we are going to close to topic anyways
+ return;
+ }
+ }
+
synchronized (ManagedLedgerImpl.this) {
Review comment:
@gaoran10 I have add record the `lastLedgerCreationFailureTimestamp`
into the exception block. We couldn't merge the exception block here due to the
`metadataMutex` unlock.
##########
File path:
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
##########
@@ -1466,6 +1452,20 @@ public void operationFailed(MetaStoreException e) {
metadataMutex.unlock();
+ if (e instanceof BadVersionException) {
Review comment:
Addressed.
--
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]