-
Notifications
You must be signed in to change notification settings - Fork 13.8k
[FLINK-26645][Connector/Pulsar] Fix Pulsar source subscriber consume from all partitions when only subscribed to 1 partition #19092
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
String name = topicName.getPartitionedTopicName(); | ||
int index = topicName.getPartitionIndex(); | ||
|
||
TopicMetadata metadata = queryTopicMetadata(pulsarAdmin, name); |
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.
For a partition, should the topicMetadata be created manually or query from the admin api ?
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.
Query from admin API is ok.
BK-1.14, BK-1.15 are required. |
} | ||
|
||
public static boolean isPartitioned(String topic) { | ||
public static boolean isPartitionOfPartitionedTopic(String topic) { |
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.
isPartitionOfTopic
?
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.
Sure, this is a more concise naming~
ffc7781
to
0cffb7e
Compare
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.
Looks quite good to me. The test need some fixes concerning used resources.
operator().deleteTopic(topic1); | ||
operator().deleteTopic(topic2); |
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.
these should be executed in a finally statement or else a failing test will leave the topic.
Alternatively, if topic creation is not taking too long, just create and delete all topics in @beforeeach and @AfterEach. Do we even need to create them for each test? Maybe BeforeAll is sufficient?
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.
I think you are right, I have fixed this issue.
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.
LGTM. Merging. Can you please create the backport PRs?
What is the purpose of the change
Fix FLINK-26645: When users specify only consume from 1 partition but the source consumes from all partitions.
Brief change log
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
No
Documentation
No