void handleDirectoriesOffline(
        int brokerId,
        long brokerEpoch,
        List<Uuid> offlineDirs,
        List<ApiMessageAndVersion> records
    ) {
        BrokerRegistration registration = clusterControl.registration(brokerId);
        List<Uuid> newOfflineDirs = registration.directoryIntersection(offlineDirs);
        if (!newOfflineDirs.isEmpty()) {
            for (Uuid newOfflineDir : newOfflineDirs) {
                TimelineHashSet<TopicIdPartition> parts = directoriesToPartitions.get(newOfflineDir);
                Iterator<TopicIdPartition> iterator = (parts == null) ?
                        Collections.emptyIterator() : parts.iterator();
                generateLeaderAndIsrUpdates(
                        "handleDirectoriesOffline[" + brokerId + ":" + newOfflineDir + "]",
                        brokerId, NO_LEADER, NO_LEADER, records, iterator);
            }
            List<Uuid> newOnlineDirs = registration.directoryDifference(offlineDirs);
            records.add(new ApiMessageAndVersion(new BrokerRegistrationChangeRecord().
                    setBrokerId(brokerId).setBrokerEpoch(brokerEpoch).
                    setLogDirs(newOnlineDirs),
                    (short) 2));
            log.warn("Directories {} in broker {} marked offline, remaining directories: {}",
                    newOfflineDirs, brokerId, newOnlineDirs);
        }
    }
Generates the appropriate records to handle a list of directories being reported offline.

If the reported directories include directories that were previously online, this includes
a BrokerRegistrationChangeRecord and any number of PartitionChangeRecord to update
leadership and ISR for partitions in those directories that were previously online.

@param brokerId    The broker id.
@param brokerEpoch The broker epoch.
@param offlineDirs The list of directories that are offline.
@param records     The record list to append to.
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java