Skip to content

KAFKA-10769 Remove JoinGroupRequest#containsValidPattern as it is dup…#9851

Merged
chia7712 merged 12 commits intoapache:trunkfrom
highluck:remove-duplicate-code
Apr 7, 2021
Merged

KAFKA-10769 Remove JoinGroupRequest#containsValidPattern as it is dup…#9851
chia7712 merged 12 commits intoapache:trunkfrom
highluck:remove-duplicate-code

Conversation

@highluck
Copy link
Copy Markdown
Contributor

@highluck highluck commented Jan 9, 2021

https://issues.apache.org/jira/browse/KAFKA-10769
.cc @chia7712

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@highluck
Copy link
Copy Markdown
Contributor Author

highluck commented Jan 9, 2021

@chia7712
Please review! thanks!

@chia7712
Copy link
Copy Markdown
Member

@highluck Thanks for your patch.

The check of static group id (https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/requests/JoinGroupRequest.java#L68) is almost same to check in Topic (https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/internals/Topic.java#L36).

Should we remove the duplicate also? WDYT?

@chia7712
Copy link
Copy Markdown
Member

@abbccdda Could we reuse the code (https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/internals/Topic.java#L36) to do the validation for static member id? Please correct me if there is any concern. Thanks!

@highluck
Copy link
Copy Markdown
Contributor Author

highluck commented Jan 10, 2021

@chia7712, @abbccdda
The code was modified
How about the following?

@highluck
Copy link
Copy Markdown
Contributor Author

@chia7712 @abbccdda
Would it be okay to ask for confirmation once?

*/
public static void validateGroupInstanceId(String id) {
if (id.equals(""))
throw new InvalidConfigurationException("Group instance id must be non-empty string");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exception is changed from InvalidConfigurationException to InvalidTopicException. It results in different Errors so I feel it would be better to keep throwing InvalidConfigurationException for this check

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I modified code thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @chia7712
thanks

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the following check have similar issue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chia7712
Would it be okay to explain a little more about what follow check means?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for unclear comment :(

My point was error type thrown by following checks was changed also.

Copy link
Copy Markdown
Contributor Author

@highluck highluck Mar 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chia7712
thanks
I modified code!
I think everything will be fine if I modify it like this. How about?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @chia7712
thanks!

@highluck highluck requested a review from chia7712 March 4, 2021 15:42
@highluck
Copy link
Copy Markdown
Contributor Author

ping @chia7712
Please give me a review

Copy link
Copy Markdown
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@highluck thanks for updating code. please take a look at following comments. thanks!

for (char c : invalidChars) {
String instanceId = "Is " + c + "illegal";
assertFalse(JoinGroupRequest.containsValidPattern(instanceId));
assertFalse(Topic.containsValidPattern(instanceId));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* Valid characters for Kafka topics are the ASCII alphanumerics, '.', '_', and '-'
*/
static boolean containsValidPattern(String topic) {
public static boolean containsValidPattern(String topic) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is unnecessary if we remove the duplicate test case.

@highluck highluck requested a review from chia7712 March 26, 2021 16:09
@highluck
Copy link
Copy Markdown
Contributor Author

ping @chia7712
Please give me a review
thanks!

@chia7712
Copy link
Copy Markdown
Member

@highluck Could you merge trunk to trigger QA again? It seems our jenkins was on vacation before :)

@highluck
Copy link
Copy Markdown
Contributor Author

highluck commented Apr 1, 2021

@chia7712 There seems to be some hung builds. Shall we merge again?

@chia7712
Copy link
Copy Markdown
Member

chia7712 commented Apr 1, 2021

yep, please merge trunk. Thanks!

@highluck
Copy link
Copy Markdown
Contributor Author

highluck commented Apr 5, 2021

@chia7712 There seems to be some test fail.
Shall we merge again?!

Copy link
Copy Markdown
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@highluck thanks for updating code. one last comment is left. Please fix it and then I will merge this patch.

}
}


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove those indents.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chia7712
thanks i updated code

@chia7712 chia7712 merged commit be592df into apache:trunk Apr 7, 2021
ijuma added a commit to ijuma/kafka that referenced this pull request Apr 7, 2021
* apache-github/trunk:
  KAFKA-10769 Remove JoinGroupRequest#containsValidPattern as it is dup… (apache#9851)
  KAFKA-12384: stabilize ListOffsetsRequestTest#testResponseIncludesLeaderEpoch (apache#10389)
  KAFKA-5146: remove Connect dependency from Streams module (apache#10131)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants