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 2021/09/12 14:54:03 UTC

[GitHub] [pulsar] gaoran10 commented on a change in pull request #12015: Fix update ledger list to znode version mismatch failed, ledger not delete

gaoran10 commented on a change in pull request #12015:
URL: https://github.com/apache/pulsar/pull/12015#discussion_r706849221



##########
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:
       Could we add the exception check here? We could record the `lastLedgerCreationFailureTimestamp`.




-- 
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