KAFKA-13063: Make DescribeConsumerGroupsHandler unmap for COORDINATOR_NOT_AVAILABLE error#11022
KAFKA-13063: Make DescribeConsumerGroupsHandler unmap for COORDINATOR_NOT_AVAILABLE error#11022dajac merged 5 commits intoapache:trunkfrom
Conversation
| private void validateGroupsNotEmpty(List<DescribedGroup> describedGroups) { | ||
| if (describedGroups.isEmpty()) { | ||
| throw new InvalidGroupIdException("No consumer group found"); | ||
| } | ||
| } |
There was a problem hiding this comment.
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.
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.
You're right! We accept multiple groups. Updated. Thanks.
| 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.
groupsToRetry to retry is not really necessary in this case. We don't even use it later. Could we remove it?
| } | ||
| return new ApiResult<>(completed, failed, unmapped); | ||
|
|
||
| return new ApiResult<>(completed, failed, new ArrayList<>(groupsToUnmap)); |
There was a problem hiding this comment.
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.
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.
Agree. I just follow the previous behavior. Remove the error message. Thanks.
| } | ||
|
|
||
| } | ||
| } No newline at end of file |
|
@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. |
|
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)