KAFKA-14194: Fix NPE in Cluster.nodeIfOnline#12584
Merged
dajac merged 2 commits intoapache:trunkfrom Sep 5, 2022
Merged
Conversation
dajac
reviewed
Sep 2, 2022
| public void testNodeIfOnlineNonExistentTopicPartition() { | ||
| Node node0 = new Node(0, "localhost", 9092); | ||
|
|
||
| MetadataResponse metadataResponse = RequestTestUtils.metadataUpdateWith("dummy", 2, Collections.emptyMap(), Collections.emptyMap(), _tp -> 99, |
Member
There was a problem hiding this comment.
Could we use RequestTestUtils.metadataUpdateWith(2, Collections.emptyMap())? It seems to me that we would end up with the same result because of the empty maps.
Contributor
Author
There was a problem hiding this comment.
Thank you for pointing out this test helper, I made the change.
| new MetadataResponse.PartitionMetadata(error, partition, Optional.of(node0.id()), leaderEpoch, | ||
| Collections.singletonList(node0.id()), Collections.emptyList(), | ||
| Collections.emptyList()), ApiKeys.METADATA.latestVersion(), Collections.emptyMap()); | ||
| metadata.updateWithCurrentRequestVersion(emptyMetadataResponse(), false, 0L); |
Contributor
Author
There was a problem hiding this comment.
No, it doesn't seem to be, removed.
Contributor
Author
|
@dajac Thank you for the feedback! I've incorporated the changes you suggested and ran the test case without my change to |
Member
|
@dajac do we need to backport this? |
dajac
pushed a commit
that referenced
this pull request
Sep 9, 2022
When utilizing the rack-aware consumer configuration and rolling updates are being applied to the Kafka brokers the metadata updates can be in a transient state and a given topic-partition can be missing from the metadata. This seems to resolve itself after a bit of time but before it can resolve the `Cluster.nodeIfOnline` method throws an NPE. This patch checks to make sure that a given topic-partition has partition info available before using that partition info. Reviewers: David Jacot <djacot@confluent.io>
dajac
pushed a commit
that referenced
this pull request
Sep 9, 2022
When utilizing the rack-aware consumer configuration and rolling updates are being applied to the Kafka brokers the metadata updates can be in a transient state and a given topic-partition can be missing from the metadata. This seems to resolve itself after a bit of time but before it can resolve the `Cluster.nodeIfOnline` method throws an NPE. This patch checks to make sure that a given topic-partition has partition info available before using that partition info. Reviewers: David Jacot <djacot@confluent.io>
Member
philipnee
pushed a commit
to confluentinc/kafka
that referenced
this pull request
Sep 14, 2022
When utilizing the rack-aware consumer configuration and rolling updates are being applied to the Kafka brokers the metadata updates can be in a transient state and a given topic-partition can be missing from the metadata. This seems to resolve itself after a bit of time but before it can resolve the `Cluster.nodeIfOnline` method throws an NPE. This patch checks to make sure that a given topic-partition has partition info available before using that partition info. Reviewers: David Jacot <djacot@confluent.io>
fmin
added a commit
to confluentinc/kafka
that referenced
this pull request
Sep 14, 2022
…2-14-SEP-2022 * apache-kafka/3.2: (45 commits) MINOR: Bump version in upgrade guide to 3.2.3 KAFKA-14208; Do not raise wakeup in consumer during asynchronous offset commits (apache#12626) KAFKA-14196; Do not continue fetching partitions awaiting auto-commit prior to revocation (apache#12603) MINOR: 3.2 branch version to 3.2.3-SNAPSHOT Bump version to 3.2.2 Upgrade Netty and Jackson versions for CVE fixes [KAFKA-14044] (apache#12376) KAFKA-14194: Fix NPE in Cluster.nodeIfOnline (apache#12584) MINOR: Update LICENSE-binary MINOR: Align Scala version to 2.13.8 MINOR: Bump version in upgrade guide to 3.2.2 ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When utilizing the rack-aware consumer configuration and rolling updates are being applied to the Kafka brokers the metadata updates can be in a transient state and a given topic-partition can be missing from the metadata. This seems to resolve itself after a bit of time but before it can resolve the
Cluster.nodeIfOnlinemethod throws an NPE. This PR checks to make sure that a given topic-partition has partition info available before using that partition info.Committer Checklist (excluded from commit message)