Hi all

I noticed that the PIP-145 made a break change that caused clients to not
subscribe to partitioned topics with a suffix-matched regexp.

### Background
PIP-145(https://github.com/apache/pulsar/issues/14505) moved the logic of
regexp compare from client-side to the broker-side.
After PIP-145, Pulsar uses the partition name(E.g., "topic-partition-0") to
match the Regexp. But the original behavior is to use a partitioned topic
name(E.g., "topic")  to match the Regexp.

### The behavior change 1
- start a consumer with `topicPattern`:
`persistent://my-property/my-ns/pattern-.*-1`
- create a partitioned topic `persistent://my-tenant/my-ns/pattern-topic-x`
with `4` partitions

`3.0.2`: the consumer will automatically add `4` internal consumers for the
`4` partitions.
`2.10.5`: No internal consumers added.

### The behavior change 2
- start a consumer with regexp `persistent://public/default/tp$`
- create a partitioned topic persistent://public/default/tp` with `4`
partitions

`3.0.2`: the pattern consumer has no internal consumers.
`2.10.5`: the consumer will automatically add `4` internal consumers for
the `4` partitions.

### Summary
After PIP-145, there are two behaviors are confused:
- You can not use a suffix-regexp to subscribe to the partitioned topics.
- You will get all partitions if you just want one partition with a
suffix-regexp `-partition-0`. And before PIP-145, you will get no topics.
This behavior is not supported on all versions, but the behavior is not the
same.

### Fix
I pushed a PR to revert the behavior to the original(before PIP-145). See:
https://github.com/apache/pulsar/pull/21885.


Thanks
Yubiao Femg

Reply via email to