KAFKA-16095: Update list group state type filter to include the states for the new consumer group type#15211
Conversation
…s for the new consumer group type
|
@rreddy-22 PTAL. |
rreddy-22
left a comment
There was a problem hiding this comment.
Thanks for the PR! Left a few comments
|
@rreddy-22 Thanks for your comments. I addressed them. |
rreddy-22
left a comment
There was a problem hiding this comment.
Thanks for the update! We're currently still straightening out the details on how to implement the case insensitivity for the group type filter. I'll get back to you asap once we figure that out!
|
Thanks for the suggestion @dajac . I have addressed the comments. |
| } | ||
|
|
||
| ClassicGroupState(String name) { | ||
| ClassicGroupState(String name, String lowerCaseName) { |
There was a problem hiding this comment.
nit: I wonder if we could remove the lowerCaseName parameter and lower case the name in the constructor. Would it work?
| return name; | ||
| } | ||
|
|
||
| public String toLowerCaseString() { |
There was a problem hiding this comment.
nit: I wonder if we should also add toLowerCaseString to ConsumerGroup.ConsumerGroupState in order to be consistent.
There was a problem hiding this comment.
Actually, it would be great to do the same there. We could also capitatlize the states to be consistent too.
There was a problem hiding this comment.
Thanks for the suggestion, I added the toCapitalizedString to ConsumerGroup.ConsumerGroupState.
|
|
||
| @Override | ||
| public boolean isInStatesCaseInsensitive(List<String> statesFilter, long committedOffset) { | ||
| Set<String> caseInsensitiveFilterSet = statesFilter.stream().map(String::toLowerCase).map(String::trim).collect(Collectors.toSet()); |
There was a problem hiding this comment.
It is a tad annoying to call toLowerCase here because we have to do it for every group. Would it be better to keep this part on the calling side?
| /** | ||
| * @return The {{@link GroupType}}'s LowerCase String representation based on the committed offset. | ||
| */ | ||
| String stateAsLowerCaseString(long committedOffset); |
There was a problem hiding this comment.
It seems that we only access it from within the class so we could remove it from the interface.
|
Addressed your review comments. PTAL when you get chance! |
|
@DL1231 Thanks. I’ll review it on Monday. I had a quick |
|
|
||
| @Override | ||
| public boolean isInStates(Set<String> statesFilter, long committedOffset) { | ||
| return statesFilter.contains(this.stateAsLowerCaseString()) || statesFilter.contains(this.stateAsString()); |
There was a problem hiding this comment.
I am not sure to understand why do we need to check both versions here? If the statesFilter are lowercased, the first one should be enough, no?
There was a problem hiding this comment.
In my opinion, the statefilter cannot be guaranteed to be in lowercase, there might be that the method isinstates is called without doing the lowercase conversion, so needs to check for both versions here.
There was a problem hiding this comment.
Yeah, it is not but in this context we know that it is. Could we address this by clarifying the requirement in the javadoc? My point is that if statesFilter is not lowercased, it won't work anyway because you could also received something like sTable.
| public String stateAsLowerCaseString() { | ||
| return this.state.toLowerCaseString(); | ||
| } |
There was a problem hiding this comment.
We could probably remove this one and inline it.
| return statesFilter.contains(this.stateAsCapitalizedString(committedOffset)) || statesFilter.contains( | ||
| this.stateAsString(committedOffset)); |
There was a problem hiding this comment.
Same question about checking the two versions here.
| public String stateAsCapitalizedString(long committedOffset) { | ||
| return state.get(committedOffset).toCapitalizedString(); | ||
| } |
There was a problem hiding this comment.
Same suggestion about inlining it.
| } | ||
|
|
||
| def isInStates(states: collection.Set[String]): Boolean = { | ||
| states.contains(state.toString) || states.contains(state.toLowerCaseString) |
…s for the new consumer group type (apache#15211) While using —list —state the current accepted values correspond to the classic group type states. This patch adds the new states introduced by KIP-848. It also make the matching on the server case insensitive. Co-authored-by: d00791190 <dinglan6@huawei.com> Reviewers: Ritika Reddy <rreddy@confluent.io>, David Jacot <djacot@confluent.io>
…s for the new consumer group type (apache#15211) While using —list —state the current accepted values correspond to the classic group type states. This patch adds the new states introduced by KIP-848. It also make the matching on the server case insensitive. Co-authored-by: d00791190 <dinglan6@huawei.com> Reviewers: Ritika Reddy <rreddy@confluent.io>, David Jacot <djacot@confluent.io>
…s for the new consumer group type (apache#15211) While using —list —state the current accepted values correspond to the classic group type states. This patch adds the new states introduced by KIP-848. It also make the matching on the server case insensitive. Co-authored-by: d00791190 <dinglan6@huawei.com> Reviewers: Ritika Reddy <rreddy@confluent.io>, David Jacot <djacot@confluent.io>
While using —list —state the current accepted values correspond to the classic group type states.
This PR include support for the new group type states.
Committer Checklist (excluded from commit message)