Skip to content
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

MINOR : Add missing error code in ConsumerHeartbeatRequestManagerTest. #19024

Merged

Conversation

ShivsundarR
Copy link
Contributor

@ShivsundarR ShivsundarR commented Feb 25, 2025

What
PR fixes a minor bug in https://github.com/apache/kafka/pull/18986/files#diff-9fbddcb7950c03d236f3791df42fe4de0feb6d4ff25c7d8bec80545ff9378af3R585.

The test was previously not taking in the intented error code (TOPIC_AUTHORIZATION_FAILED), now it would.

Updated javadocs for ConsumerHeartbeatResponse and ConsumerDescribeResponse.

@github-actions github-actions bot added triage PRs from the community consumer tests Test fixes (including flaky tests) clients small Small PRs labels Feb 25, 2025
@AndrewJSchofield AndrewJSchofield added ci-approved and removed triage PRs from the community labels Feb 25, 2025
Copy link
Member

@lianetm lianetm left a comment

Choose a reason for hiding this comment

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

Thanks @ShivsundarR ! Just one nit.

Related thought: there is a very similar test in ShareMembershipMgr (testHeartbeatResponseOnErrorHandling), but instead of duplicating this check there, I wonder if that test makes sense on it's own or is more a duplicate that should be removed? The logic to handle responses is not specific to the share mgr (it's defined in the AbstractMembershipMgrTest), so isn't the test in ConsumerHeartbeatRequestManagerTest enough?

@@ -1029,7 +1029,8 @@ private static Collection<Arguments> errorProvider() {
Arguments.of(Errors.UNSUPPORTED_VERSION, true),
Arguments.of(Errors.UNRELEASED_INSTANCE_ID, true),
Arguments.of(Errors.FENCED_INSTANCE_ID, true),
Arguments.of(Errors.GROUP_MAX_SIZE_REACHED, true));
Arguments.of(Errors.GROUP_MAX_SIZE_REACHED, true),
Arguments.of(Errors.TOPIC_AUTHORIZATION_FAILED, true));
Copy link
Member

Choose a reason for hiding this comment

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

nit: even thought it's a non-retriable exception, this is not considered fatal in the client, so we should pass false here. (It doesn't affect the test now because the isFatal param is not used in this specific case, but just to make it right in case we change the test in the future)

Copy link
Contributor Author

@ShivsundarR ShivsundarR Feb 25, 2025

Choose a reason for hiding this comment

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

Thanks, okay yeah I will change it to false, makes sense.
Also for the ShareHeartbeatRequestManagerTest, yes they are identical, except there is one check missing in that test which is present in ConsumerHeartbeatRequestManagerTest.

case FENCED_MEMBER_EPOCH:
verify(backgroundEventHandler, never()).add(any());
assertNextHeartbeatTiming(0);
break;

Also in future if we decide to handle heartbeat responses differently for regular consumers and share consumers, it will be better to have 2 different tests right?

Copy link
Member

@lianetm lianetm Feb 25, 2025

Choose a reason for hiding this comment

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

the ShareHeartbeatRequestManagerTest, yes they are identical, except there is one check missing

Exactly, that shows how the Share test has already fallen behind, it is redundant and we're not maintaining it. We should review and remove it imo (but can be done separately, I just noticed it here)

if we decide to handle heartbeat responses differently for regular consumers and share consumers, it will be better to have 2 different

yes, but better to add it when needed (and not have a duplicate now that we either maintain or leave behind)

I will file a jira and we can consider the improvement separately.
-- update
https://issues.apache.org/jira/browse/KAFKA-18862

Copy link
Contributor Author

@ShivsundarR ShivsundarR Feb 25, 2025

Choose a reason for hiding this comment

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

Okay yeah that makes sense. Thank you.

Copy link
Member

@lianetm lianetm left a comment

Choose a reason for hiding this comment

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

Thanks @ShivsundarR ! LGTM

@lianetm lianetm merged commit fae2e53 into apache:trunk Feb 25, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-approved clients consumer small Small PRs tests Test fixes (including flaky tests)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants