Repository: apache/kafka
File: server-common/src/main/java/org/apache/kafka/server/common/MetadataVersion.java (Java)

Code before:
    // Bootstrap metadata version for version 1 of the GroupVersion feature (KIP-848).
    IBP_4_0_IV0(22, "4.0", "IV0", false),

    // Add ELR related metadata records (KIP-966). Note, ELR is for preview only in 4.0.
    // PartitionRecord and PartitionChangeRecord are updated.
    // ClearElrRecord is added.
    IBP_4_0_IV1(23, "4.0", "IV1", true),

    // Bootstrap metadata version for transaction versions 1 and 2 (KIP-890)
    IBP_4_0_IV2(24, "4.0", "IV2", false),

    // Enables async remote LIST_OFFSETS support (KIP-1075)
    IBP_4_0_IV3(25, "4.0", "IV3", false),

    // Enables ELR by default for new clusters (KIP-966).
    IBP_4_1_IV0(26, "4.1", "IV0", false),

    // Send FETCH version 18 in the replica fetcher (KIP-1166)
    IBP_4_1_IV1(27, "4.1", "IV1", false),

    //
    // NOTE: MetadataVersions after this point are unstable and may be changed.
    // If users attempt to use an unstable MetadataVersion, they will get an error.
    // Please move this comment when updating the LATEST_PRODUCTION constant.
    //

    // Enables share groups by default for new clusters (KIP-932).
    IBP_4_2_IV0(28, "4.2", "IV0", false),

    // Enables "streams" groups by default for new clusters (KIP-1071).
    IBP_4_2_IV1(29, "4.2", "IV1", false);

    // NOTES when adding a new version:
    //   Update the default version in @ClusterTest annotation to point to the latest version
    //   Change expected message in org.apache.kafka.tools.FeatureCommandTest in multiple places (search for "Change expected message")
    public static final String FEATURE_NAME = "metadata.version";

    /**
     * Minimum supported version.
     */
    public static final MetadataVersion MINIMUM_VERSION = IBP_3_3_IV3;

    /**
     * The latest production-ready MetadataVersion. This is the latest version that is stable
     * and cannot be changed. MetadataVersions later than this can be tested via junit, but
     * not deployed in production.
     *
     * <strong>Think carefully before you update this value. ONCE A METADATA VERSION IS PRODUCTION,
     * IT CANNOT BE CHANGED.</strong>
     */
    public static final MetadataVersion LATEST_PRODUCTION = IBP_4_1_IV1;

Review comment (bug):
The comment `If users attempt to use an unstable MetadataVersion, they will get an error.` seems to be incorrect. Users can use an unstable MV by enabling `unstable.feature.versions.enable`, so they won't necessarily get an error

Code after:
    // Bootstrap metadata version for version 1 of the GroupVersion feature (KIP-848).
    IBP_4_0_IV0(22, "4.0", "IV0", false),

    // Add ELR related metadata records (KIP-966).
    // Note, ELR was for preview only in 4.0 which required enabling explicitly.
    // PartitionRecord and PartitionChangeRecord are updated.
    // ClearElrRecord is added.
    IBP_4_0_IV1(23, "4.0", "IV1", true),

    // Bootstrap metadata version for transaction versions 1 and 2 (KIP-890)
    IBP_4_0_IV2(24, "4.0", "IV2", false),

    // Enables async remote LIST_OFFSETS support (KIP-1075)
    IBP_4_0_IV3(25, "4.0", "IV3", false),

    // Enables ELR by default for new clusters (KIP-966).
    IBP_4_1_IV0(26, "4.1", "IV0", false),

    // Send FETCH version 18 in the replica fetcher (KIP-1166)
    IBP_4_1_IV1(27, "4.1", "IV1", false),

    //
    // NOTE: MetadataVersions after this point are unstable and may be changed.
    // If users attempt to use an unstable MetadataVersion, they will get an error unless
    // they have set the configuration unstable.feature.versions.enable=true.
    // Please move this comment when updating the LATEST_PRODUCTION constant.
    //

    // Enables share groups by default for new clusters (KIP-932).
    IBP_4_2_IV0(28, "4.2", "IV0", false),

    // Enables "streams" groups by default for new clusters (KIP-1071).
    IBP_4_2_IV1(29, "4.2", "IV1", false);

    // NOTES when adding a new version:
    //   Update the default version in @ClusterTest annotation to point to the latest version
    //   Change expected message in org.apache.kafka.tools.FeatureCommandTest in multiple places (search for "Change expected message")
    public static final String FEATURE_NAME = "metadata.version";

    /**
     * Minimum supported version.
     */
    public static final MetadataVersion MINIMUM_VERSION = IBP_3_3_IV3;

    /**
     * The latest production-ready MetadataVersion. This is the latest version that is stable
     * and cannot be changed. MetadataVersions later than this can be tested via junit, but
     * not deployed in production.
     *
     * <strong>Think carefully before you update this value. ONCE A METADATA VERSION IS PRODUCTION,
     * IT CANNOT BE CHANGED.</strong>