void handleBrokerUnregistered(int brokerId, long brokerEpoch,
                                  List<ApiMessageAndVersion> records) {
        generateLeaderAndIsrUpdates("handleBrokerUnregistered", brokerId, NO_LEADER, NO_LEADER, records,
            brokersToIsrs.partitionsWithBrokerInIsr(brokerId));
        generateLeaderAndIsrUpdates("handleBrokerUnregistered", brokerId, NO_LEADER, NO_LEADER, records,
            brokersToElrs.partitionsWithBrokerInElr(brokerId));
        records.add(new ApiMessageAndVersion(new UnregisterBrokerRecord().
            setBrokerId(brokerId).setBrokerEpoch(brokerEpoch),
            (short) 0));
        // AutoMQ for Kafka inject start
        records.add(nodeControlManager.unregisterNodeRecord(brokerId));
        records.addAll(clusterControl.unRegisterBrokerRecords(brokerId));
        // AutoMQ for Kafka inject end
    }
Generate the appropriate records to handle a broker being unregistered.

First, we remove this broker from any ISR or ELR. Then we generate an
UnregisterBrokerRecord.

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