hangc0276 opened a new pull request #12015:
URL: https://github.com/apache/pulsar/pull/12015
### Motivation
When Zookeeper throws `Failed to update ledger list. z-node version
mismatch. Closing managed ledger` exception when update ZNode list, it will not
clean up the created ledger, which will lead to the new created ledger not be
indexed to the topic managedLedger list, and can't be cleanup as topic
retention. What's more, it will cause ZNode number increase in Zookeeper if the
`z-node version mismatch` exception keeping throw out. The exception list as
follow:
```
10:44:29.017 [main-EventThread] INFO
org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl -
[test/test/persistent/test_v1-partition-4] Created new ledger 67311140
10:44:29.018 [bookkeeper-ml-workers-OrderedExecutor-2-0] ERROR
org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl -
[test/test/persistent/test_v1-partition-4] Failed to update ledger list. z-node
version mismatch. Closing managed ledger
10:44:29.018 [bookkeeper-ml-workers-OrderedExecutor-2-0] INFO
org.apache.pulsar.broker.service.Producer - Disconnecting producer:
Producer{topic=PersistentTopic{topic=persistent://test/test/test_v1-partition-4},
client=/10.1.2.3:38938, producerName=pulsar-101-1123, producerId=20}
```
### Modification
1. When updating ZNode list failed, delete the created ledger from broker
cache and BookKeeper, regardless of whether the exception type is
BadVersionException or not.
--
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]