-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix] [broker] Fix break change: could not subscribe partitioned topic with a suffix-matched regexp due to a mistake of PIP-145 #21885
[fix] [broker] Fix break change: could not subscribe partitioned topic with a suffix-matched regexp due to a mistake of PIP-145 #21885
Conversation
…exp due to PIP-145
pulsar-common/src/main/java/org/apache/pulsar/common/topics/TopicList.java
Outdated
Show resolved
Hide resolved
pulsar-common/src/main/java/org/apache/pulsar/common/topics/TopicList.java
Outdated
Show resolved
Hide resolved
/pulsarbot run-failure-checks |
pulsar-common/src/main/java/org/apache/pulsar/common/topics/TopicList.java
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/PatternTopicsConsumerImplTest.java
Show resolved
Hide resolved
pulsar-common/src/main/java/org/apache/pulsar/common/topics/TopicList.java
Outdated
Show resolved
Hide resolved
pulsar-common/src/main/java/org/apache/pulsar/common/topics/TopicList.java
Outdated
Show resolved
Hide resolved
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #21885 +/- ##
============================================
- Coverage 73.58% 73.52% -0.06%
- Complexity 32325 32345 +20
============================================
Files 1859 1859
Lines 138263 138359 +96
Branches 15153 15159 +6
============================================
- Hits 101736 101732 -4
- Misses 28644 28743 +99
- Partials 7883 7884 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…ic with a suffix-matched regexp due to a mistake of PIP-145 (#21885)
closeAllConnections.invoke(pool, new Object[]{}); | ||
} | ||
|
||
public void reconnectAllConnections() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks Pulsar SQL / Trino tests in branch-3.1 and before. I created #21976 to address the problem.
…ic with a suffix-matched regexp due to a mistake of PIP-145 (apache#21885) (cherry picked from commit 4ebbd2f) (cherry picked from commit ce8c291)
…ic with a suffix-matched regexp due to a mistake of PIP-145 (apache#21885) (cherry picked from commit 4ebbd2f) (cherry picked from commit ce8c291)
Motivation
public/default/tp
has one partition namedpublic/default/tp-partition-0
. Pulsar will usepublic/default/tp
to match the Regexp[1].public/default/tp
has one partition namedpublic/default/tp-partition-0
. Pulsar will usepublic/default/tp-partition-0
to match the Regexp[2].It is a break change that is not expected; these changes are due to a mistake, and we should correct it.
Issue
If a consumer tries to subscribe to a partitioned topic with a suffix-matched regexp, it does not work.
persistent://public/default/tp
persistent://public/default/tp$
You can reproduce the issue by the test
testPreciseRegexpSubscribe
.2.10.x
>=2.11.0
Modifications
Revert the behavior as the original implementation(before PIP-145)
Footnotes
[1]: the implementation of
2.10.x
BinaryProtoLookupService.getTopicsUnderNamespace
merge partitions to one partitioned topic. E.g.) Pulsar client mergespublic/default/tp-partition-0
andpublic/default/tp-partition-1
to ``public/default/tp`PulsarClientImpl.topicsPatternFilter
Use the partitioned topic name to match the regexp.BinaryProtoLookupService.getTopicsUnderNamespace
: https://github.com/apache/pulsar/blob/branch-2.10/pulsar-client/src/main/java/org/apache/pulsar/client/impl/BinaryProtoLookupService.java#L332-L338PulsarClientImpl.topicsPatternFilter
: https://github.com/apache/pulsar/blob/branch-2.10/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java#L568-L577[2]: the implementation of
>=2.11.0
TopicList.filterTopics()
uses the partition name to match the regexp directly. See: https://github.com/apache/pulsar/blob/master/pulsar-common/src/main/java/org/apache/pulsar/common/topics/TopicList.java#L53-L57Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: x