-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][client] Fix subscription topic name error. #16719
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
Conversation
|
@codelipenghui @gaozhangmin @Technoboy- @nodece Please help review. |
codelipenghui
left a comment
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.
Nice catch!
mattisonchao
left a comment
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.
Good catch!
|
@andrasbeni Could you help to review it? |
BewareMyPower
left a comment
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.
Could you add a unit test to protect this change?
@BewareMyPower Thanks for your reminder, I looked again, and It is found that we cannot be modify the logic in the client.newConsumer().topic(
"persistent://public/dafault/test-topic1-partition-0",
"persistent://public/dafault/test-topic2-partition-1"
);If force subscription to PartitionTopic inside the method, Then all partitions of So, I revert the original changes. The new changes are: Inside the @codelipenghui @mattisonchao @Technoboy- @nodece @BewareMyPower Sorry, please help review again. |
Make sense. |
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/PatternTopicsConsumerImplTest.java
Show resolved
Hide resolved
45e8938 to
a17c5e9
Compare
a17c5e9 to
2d4d36a
Compare
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PatternMultiTopicsConsumerImpl.java
Show resolved
Hide resolved
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PatternMultiTopicsConsumerImpl.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/PatternTopicsConsumerImplTest.java
Show resolved
Hide resolved
…ernMultiTopicsConsumerImpl.java Co-authored-by: Yunze Xu <xyzinfernity@163.com>
|
/pulsarbot run-failure-checks |
#16374 #16556 #16375 #16599
Motivation
This is a bug, after [PIP-145],
PatternMultiTopicsConsumercan receiveCommandWatchTopicUpdatefrom broker to subscribe new topic.But this topic name is with the partition index(case: public/default/test-topic-partition-0), This will produce unexpected behavior when executing the following subscribe method.
pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java
Lines 935 to 942 in 9c93ab4
The reasons for these failed unit tests are:
When the client receives the
CommandWatchTopicUpdatecommand, it will enter the logic of processing non-partitions, then only process the consumer collection and not the partitionedTopics collectionpulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java
Lines 1068 to 1094 in 9c93ab4
Then, when we execute the
consumer1.run(consumer1.getRecheckPatternTimeout())to trigger the update subscription on the unit test, By executing the following logic, will causetopic-4to be removed and added at the same time. ultimately destabilizes unit tests (maybe deletes will be executed after additions)pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PatternMultiTopicsConsumerImpl.java
Lines 115 to 121 in 9c93ab4
Print log here:

Can See:
Modifications
getPartitionedTopicName().Documentation
doc-not-needed(Please explain why)