public short registerBrokerRecordVersion() {
        if (isDirectoryAssignmentSupported()) {
            // new logDirs field
            return (short) 3;
        } else if (isMigrationSupported()) {
            // new isMigrationZkBroker field
            return (short) 2;
        } else if (isInControlledShutdownStateSupported()) {
            return (short) 1;
        } else {
            return (short) 0;
        }
    }
An array containing all of the MetadataVersion entries.

This is essentially a cached copy of MetadataVersion.values. Unlike that function, it doesn't
allocate a new array each time.
server-common/src/main/java/org/apache/kafka/server/common/MetadataVersion.java