-
Notifications
You must be signed in to change notification settings - Fork 14.9k
KAFKA-13063: Make DescribeConsumerGroupsHandler unmap for COORDINATOR_NOT_AVAILABLE error #11022
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
| private void validateGroupsNotEmpty(List<DescribedGroup> describedGroups) { | ||
| if (describedGroups.isEmpty()) { | ||
| throw new InvalidGroupIdException("No consumer group found"); | ||
| } | ||
| } |
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.
What's the purpose of this check? I am not sure where this InvalidGroupIdException thrown here will get to.
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.
Before KIP-699, there's the check:
if (describedGroups.isEmpty()) {
context.future().completeExceptionally(
new InvalidGroupIdException("No consumer group found for GroupId: " + context.groupId()));
return;
}But, you're right, the exception thrown will not return back to requester. Also, because there's no group found, we cannot have a failed key return because we need a group in key.
Removed it since it should never happen.
| } | ||
| return new ApiResult<>(completed, failed, unmapped); | ||
|
|
||
| if (groupsToUnmap.isEmpty() && groupsToRetry.isEmpty()) { |
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.
It seems incorrect here as well.
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.
You're right! We accept multiple groups. Updated. Thanks.
dajac
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.
@showuon Thank for the update. I left a few more comments.
| Errors error = Errors.forCode(describedGroup.errorCode()); | ||
| if (error != Errors.NONE) { | ||
| handleError(groupIdKey, error, failed, unmapped); | ||
| handleError(groupIdKey, error, failed, groupsToUnmap, groupsToRetry); |
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.
groupsToRetry to retry is not really necessary in this case. We don't even use it later. Could we remove it?
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! Updated.
| } | ||
| return new ApiResult<>(completed, failed, unmapped); | ||
|
|
||
| return new ApiResult<>(completed, failed, new ArrayList<>(groupsToUnmap)); |
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.
nit: There is an extra space before new.
| final String unexpectedErrorMsg = | ||
| String.format("`DescribeGroups` request for group id %s failed due to error %s", groupId.idValue, error); | ||
| log.error(unexpectedErrorMsg); | ||
| failed.put(groupId, error.exception(unexpectedErrorMsg)); |
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.
We don't provide the error message in any other case. Should we remove this one for the time being? I think that it is a good idea but only if we do it across the board.
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.
Agree. I just follow the previous behavior. Remove the error message. Thanks.
| } | ||
|
|
||
| } | ||
| } |
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.
nit: Could we revert this back?
clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java
Show resolved
Hide resolved
|
@dajac , I addressed your comments in this PR and all other 4 PRs. And also update the PR title and description accordingly. Please help take a look when available. Thank you. |
dajac
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.
LGTM
|
Failures are not related: |
…_NOT_AVAILABLE error (#11022) This patch improve the error handling in `DescribeConsumerGroupsHandler` and ensure that `COORDINATOR_NOT_AVAILABLE` is unmapped in order to look up the coordinator again. Reviewers: David Jacot <djacot@confluent.io>
|
Merged to trunk and to 3.0. cc @kkonstantine |
…_NOT_AVAILABLE error (apache#11022) This patch improve the error handling in `DescribeConsumerGroupsHandler` and ensure that `COORDINATOR_NOT_AVAILABLE` is unmapped in order to look up the coordinator again. Reviewers: David Jacot <djacot@confluent.io>
refactor DescribeConsumerGroupsHandler and tests. Also, put
COORDINATOR_NOT_AVAILABLEas unmap retry.the old handleResponse for
DescribeConsumerGroupsrequest:Committer Checklist (excluded from commit message)