[Bug] Seems non-partitioned topic failover subscription mode is always consistent-hashed?
- Dominant language
- Java
- Stars
- 15.3k
- Forks
- 3.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 160
Description
### Search before reporting
- [x] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
### Read release policy
- [x] I understand that [unsupported versions](https://pulsar.apache.org/contribute/release-policy/#supported-versions) don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.
### User environment
Pulsar 4.0.6
### Issue Description
Seems non-partitioned topic failover subscription mode is always consistent-hashed.
Non-partitioned topic failover pick active consumer logic, seems partitioned topic has consistent-hash switch ,but non-partitioned topic is always consistent-hashed.
https://github.com/apache/pulsar/blob/8e35e34350866e150220872e1ed6a5c7009a43e2/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractDispatcherSingleActiveConsumer.java#L129-L131
But the comment is:
https://github.com/apache/pulsar/blob/8e35e34350866e150220872e1ed6a5c7009a43e2/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractDispatcherSingleActiveConsumer.java#L97-L100
Following is the [pulsar document](https://pulsar.apache.org/docs/4.0.x/concepts-messaging/#failover), I can't find the relevant configuration to achieve the following two effects.
If there is one non-partitioned topic. The broker picks consumers in the order they subscribe to non-partitioned topics.
If there are multiple non-partitioned topics, a consumer is selected based on consumer name hash and topic name hash. The client uses the same consumer name to subscribe to all the topics.
Our production java services using non-partitioned topic failover subscription mode always switch active consumer due to scaling.
Or did I miss something important?
### Error messages
```text
```
### Reproducing the issue
Start multi consumers with failover subscription.
### Additional information
_No response_
### Are you willing to submit a PR?
- [x] I'm willing to submit a PR!
Contributor guide
Research direction
Start with AbstractDispatcherSingleActiveConsumer.java at the linked comment and selection logic, then read the Pulsar 4.0.x failover documentation. Reproduce the behavior with multiple consumers on non-partitioned topics and compare it with the documented subscription-order and consumer/topic-hash cases. Done means the observed behavior and available configuration match the documented failover semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100