Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-14170

KRaft Controller: Possible NPE when we remove topics with any offline partitions in the cluster

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 3.3.0
    • 3.3.0
    • kraft
    • None

    Description

      When we remove a topic, it goes through the following function in KRaft Controller replay method for RemoveTopicRecord:

      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);
          }
      } 

      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`

      Attachments

        Issue Links

          Activity

            People

              akhileshchg Akhilesh Chaganti
              akhileshchg Akhilesh Chaganti
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: