Skip to content

[Bug] Seems non-partitioned topic failover subscription mode is always consistent-hashed? #24747

@oneby-wang

Description

@oneby-wang

Search before reporting

  • I searched in the issues and found nothing similar.

Read release policy

  • I understand that unsupported 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.

int index = partitionIndex >= 0 && !serviceConfig.isActiveConsumerFailoverConsistentHashing()
? partitionIndex % consumersSize
: peekConsumerIndexFromHashRing(makeHashRing(consumersSize));

But the comment is:

* Pick active consumer for a topic for {@link SubType#Failover} subscription.
* If it's a non-partitioned topic then it'll pick consumer based on order they subscribe to the topic.
* If is's a partitioned topic, first sort consumers based on their priority level and consumer name then
* distributed partitions evenly across consumers with highest priority level.

Following is the pulsar document, 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


Reproducing the issue

Start multi consumers with failover subscription.

Additional information

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugThe PR fixed a bug or issue reported a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions