private void add(int brokerId, Uuid topicId, int newPartition, boolean leader) {
        if (leader) {
            newPartition = newPartition | LEADER_FLAG;
        }
        TimelineHashMap<Uuid, int[]> topicMap = isrMembers.get(brokerId);
        if (topicMap == null) {
            topicMap = new TimelineHashMap<>(snapshotRegistry, 0);
            isrMembers.put(brokerId, topicMap);
        }
        int[] partitions = topicMap.get(topicId);
        int[] newPartitions;
        if (partitions == null) {
            newPartitions = new int[1];
        } else {
            newPartitions = new int[partitions.length + 1];
            System.arraycopy(partitions, 0, newPartitions, 0, partitions.length);
        }
        newPartitions[newPartitions.length - 1] = newPartition;
        topicMap.put(topicId, newPartitions);
    }
Update our records of a partition's ISR.

@param topicId       The topic ID of the partition.
@param partitionId   The partition ID of the partition.
@param prevIsr       The previous ISR, or null if the partition is new.
@param nextIsr       The new ISR, or null if the partition is being removed.
@param prevLeader    The previous leader, or NO_LEADER if the partition had no leader.
@param nextLeader    The new leader, or NO_LEADER if the partition now has no leader.
metadata/src/main/java/org/apache/kafka/controller/BrokersToIsrs.java