[fix][client] Fix subscription topic name error. - #16719
Conversation
|
@codelipenghui @gaozhangmin @Technoboy- @nodece Please help review. |
|
@andrasbeni Could you help to review it? |
BewareMyPower
left a comment
There was a problem hiding this comment.
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. |
45e8938 to
a17c5e9
Compare
a17c5e9 to
2d4d36a
Compare
…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)