You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Akhilesh Chaganti (Jira)" <ji...@apache.org> on 2022/08/30 17:54:00 UTC

[jira] [Resolved] (KAFKA-14170) KRaft Controller: Possible NPE when we remove topics with any offline partitions in the cluster

     [ https://issues.apache.org/jira/browse/KAFKA-14170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Akhilesh Chaganti resolved KAFKA-14170.
---------------------------------------
    Resolution: Fixed

> KRaft Controller: Possible NPE when we remove topics with any offline partitions in the cluster
> -----------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-14170
>                 URL: https://issues.apache.org/jira/browse/KAFKA-14170
>             Project: Kafka
>          Issue Type: Bug
>          Components: kraft
>    Affects Versions: 3.3
>            Reporter: Akhilesh Chaganti
>            Assignee: Akhilesh Chaganti
>            Priority: Blocker
>             Fix For: 3.3
>
>
> When we remove a topic, it goes through the following function in KRaft Controller replay method for RemoveTopicRecord:
> {code:java}
> void removeTopicEntryForBroker(Uuid topicId, int brokerId) {
>     Map<Uuid, int[]> topicMap = isrMembers.get(brokerId);
>     if (topicMap != null) {
>         if (brokerId == NO_LEADER) {
>             offlinePartitionCount.set(offlinePartitionCount.get() - topicMap.get(topicId).length);
>         }
>         topicMap.remove(topicId);
>     }
> } {code}
> If the broker has any offline partitions but doesn't have offline partitions for the topic we're deleting, the above code will run into NPE because we directly access the `topicMap.get(topicId).length`



--
This message was sent by Atlassian Jira
(v8.20.10#820010)