poorbarcode opened a new pull request, #23980:
URL: https://github.com/apache/pulsar/pull/23980
### Motivation
**Background**
- The steps of unsubscribing `__compaction`
- Delete compacted ledger
- Delete cursor
- Remove subscription
**Issue 1**: consumer will stuck if deleting cursor(the step 2 above) failed
- Delete compacted ledger
- Delete cursor failed
- Reload the topic
- Compactor subscription relates to a deleted ledger
- Consumers are stuck because the compacted ledger has been deleted, and the
messages were lost. The broker will keep printing the error log below
```
2025-02-13T17:23:51,448 - ERROR -
[broker-topic-workers-OrderedExecutor-4-0:PersistentDispatcherSingleActiveConsumer]
- [persistent://public/default/tp-74ea581c-d7ca-4558-999b-804b6e33faee /
reader-801f712e61-Consumer{subscription=PersistentSubscription{topic=persistent://public/default/tp-74ea581c-d7ca-4558-999b-804b6e33faee,
name=reader-801f712e61}, consumerId=1, consumerName=Ti6va, address=[id:
0xce1b338f, L:/127.0.0.1:52193 - R:/127.0.0.1:52199] [SR:127.0.0.1,
state:Connected]}] Error reading entries at 11:0 :
org.apache.bookkeeper.client.BKException$BKNoSuchLedgerExistsException: No such
ledger exists on Bookies - Retrying to read in 15.0 seconds
```
You can reproduce the issue by the test
`testReadMsgsAfterDisableCompaction(true)`
---
**issue 2**
The compaction task can concurrently execute by deleting the cursor
`__compaction`
### Modifications
- Fix issue 1
- Fix issue 2
- Print an error log if a compactor subscription is initialized twice, which
may cause a ledger lost/
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update
later -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
### Matching PR in forked repository
PR in forked repository: x
--
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]