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

KAFKA-14744; NPE while converting OffsetFetch from version < 8 to version >= 8 #13295

Merged
merged 1 commit into from Feb 23, 2023

Conversation

dajac
Copy link
Contributor

@dajac dajac commented Feb 23, 2023

While refactoring the OffsetFetch handling in KafkaApis, we introduced a NullPointerException (NPE). The NPE arises when the FetchOffset API is called with a client using a version older than version 8 and using null for the topics to signal that all topic-partition offsets must be returned. This means that this bug mainly impacts admin tools. The consumer does not use null.

This NPE is here: 24a8642#diff-0f2f19fd03e2fc5aa9618c607b432ea72e5aaa53866f07444269f38cb537f3feR237.

We missed this during the refactor because we had no tests in place to test this mode.

Committer Checklist (excluded from commit message)

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

@dajac dajac requested a review from jolshan February 23, 2023 13:46
@@ -126,6 +126,56 @@ class OffsetFetchRequestTest extends BaseRequestTest {
}
}

@Test
def testOffsetFetchRequestAllOffsetsSingleGroup(): Unit = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one is based on testOffsetFetchRequestSingleGroup. I kept the exact same assertions.

buildRequest(new OffsetFetchRequest.Builder(
"group-1",
false,
null, // all offsets.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the important bit. We need to test with null.

@chia7712
Copy link
Contributor

@dajac
Copy link
Contributor Author

dajac commented Feb 23, 2023

Copy link
Contributor

@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.

LGTM

@dajac dajac merged commit c55e5af into apache:trunk Feb 23, 2023
@dajac dajac deleted the KAFKA-14744 branch February 23, 2023 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants