poorbarcode opened a new issue, #19187:
URL: https://github.com/apache/pulsar/issues/19187
### Motivation
We sometimes try to unload the topic to resolve some consumption-stop
issues. But the unloading topic will also impact the producer side.
### Goal
Providing a new API to perform unmounting of the subscription dimension
triggers reconnection of all consumers on that subscription (from the client's
perspective, this connection may be shared by consumers, producers, and
transactions) and reconnection is guaranteed by the client. The API will be
used in these ways:
- unload special subscription of one topic(or partitioned topic)
- unload all subscriptions of one topic(or partitioned topic)
- unload subscriptions of one topic(or partitioned topic) by regular
expression
- If a reader's subscription name is not set, a random subscription name
prefixed with 'multiTopicsReader-' or 'reader-' will be used, and users can
uninstall these subscriptions using regular expressions.
In addition to triggering consumer disconnection, Unloading Subscribers will
restart the Dispatcher, which resets the redeliver message queue and delayed
message queue in the Broker's memory, which can help resolve issues caused by
an abnormal dispatcher state. However, the execution flow of Unloading
Subscribers does not include a restart of the Managed Cursor related to this
dispatcher; if there is a problem with the cursor, we can only rely on the
unload topic to solve it.
#### These scenarios are not supported
- Functions `message-dedup`, `geo-replication,` and `shadow-topic` also read
messages from the topic, but the feature Unloading subscribers will not support
triggering restarts of these three functions( because the cursor is used
directly to read the data, not the consumer or reader ).
- The Compression task(subscription name is `__compaction`) and Recovery of
the Transaction Buffer also use a reader to read data, but Unloading
Subscribers does not trigger a reconnection because both tasks create a new
reader each time they start.
#### Special system topic supports
The system topic `__change_events` is used to support topic-level policies,
Unloading Subscribers will support the reconnection of readers on this topic.
### API Changes
v2.PersistentTopics
```java
/**
* Unload {sub} on {topic}.
* @param subName It can be a subscription name or a regular expression.
"**" represents all the subscriptions under the topic.
* It responds with error code 412 When the user tries to unload these
subscriptions: `__compaction`, `dedup`, `pulsar.repl.*`.
**/
@Path("/{tenant}/{namespace}/{topic}/{subName}/unload")
public void unloadTopic(...)
```
### Implementation
-
### Alternatives
_No response_
### Anything else?
_No response_
--
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]