Repository: ClickHouse/ClickHouse
File: src/Core/SettingsChangesHistory.cpp (C++)

Code before:
{
    /// Forbid duplicate versions
    auto [_, inserted] = settings_changes_history.emplace(ClickHouseVersion(version), std::move(changes));
    if (!inserted)
        throw Exception{ErrorCodes::LOGICAL_ERROR, "Detected duplicate version '{}'", ClickHouseVersion(version).toString()};
}

const VersionToSettingsChangesMap & getSettingsChangesHistory()
{
    static VersionToSettingsChangesMap settings_changes_history;
    static std::once_flag initialized_flag;
    std::call_once(initialized_flag, [&]
    {
        // clang-format off
        /// History of settings changes that controls some backward incompatible changes
        /// across all ClickHouse versions. It maps ClickHouse version to settings changes that were done
        /// in this version. This history contains both changes to existing settings and newly added settings.
        /// Settings changes is a vector of structs
        ///     {setting_name, previous_value, new_value, reason}.
        /// For newly added setting choose the most appropriate previous_value (for example, if new setting
        /// controls new feature and it's 'true' by default, use 'false' as previous_value).
        /// It's used to implement `compatibility` setting (see https://github.com/ClickHouse/ClickHouse/issues/35972)
        /// Note: please check if the key already exists to prevent duplicate entries.
        addSettingsChanges(settings_changes_history, "26.2",
        {
            {"deduplicate_insert", "backward_compatible_choice", "backward_compatible_choice", "New setting to control deduplication for INSERT queries."},
            {"deduplicate_blocks_in_dependent_materialized_views", false, true, "Enable deduplication for dependent materialized views by default."},
            {"deduplicate_insert", "backward_compatible_choice", "enable", "New setting to control deduplication for INSERT queries."},
            {"default_dictionary_database", "", "", "New setting"},
            {"parallel_replicas_filter_pushdown", false, false, "New setting"},

        });
        addSettingsChanges(settings_changes_history, "26.1",
        {
            {"use_statistics", true, true, "Enable this optimization by default."},
            {"ignore_on_cluster_for_replicated_database", false, false, "Add a new setting to ignore ON CLUSTER clause for DDL queries with a replicated database."},
            {"input_format_binary_max_type_complexity", 1000, 1000, "Add a new setting to control max number of type nodes when decoding binary types. Protects against malicious inputs."},
            {"distributed_index_analysis", false, false, "New experimental setting"},
            {"distributed_index_analysis_for_non_shared_merge_tree", false, false, "New setting"},
            {"distributed_cache_file_cache_name", "", "", "New setting."},
            {"trace_profile_events_list", "", "", "New setting"},
            {"query_plan_reuse_storage_ordering_for_window_functions", true, false, "Disable this logic by default."},
            {"optimize_read_in_window_order", true, false, "Disable this logic by default."},
            {"correlated_subqueries_use_in_memory_buffer", false, true, "Use in-memory buffer for input of correlated subqueries by default."},
            {"allow_experimental_database_paimon_rest_catalog", false, false, "New setting"},
            {"allow_experimental_object_storage_queue_hive_partitioning", false, false, "New setting."},
            {"type_json_use_partial_match_to_skip_paths_by_regexp", false, true, "Add new setting that allows to use partial match in regexp paths skip in JSON type parsing"},
            {"max_insert_block_size_bytes", 0, 0, "New setting that allows to control the size of blocks in bytes during parsing of data in Row Input Format."},
            {"max_insert_block_size_rows", DEFAULT_INSERT_BLOCK_SIZE, DEFAULT_INSERT_BLOCK_SIZE, "An alias for max_insert_block_size."},
            {"join_runtime_filter_pass_ratio_threshold_for_disabling", 0.7, 0.7, "New setting"},
            {"join_runtime_filter_blocks_to_skip_before_reenabling", 30, 30, "New setting"},

Review comment (refactor):
The setting `deduplicate_insert` is recorded twice in the version 26.2 changelog with different transitions. Line 44 shows no change (backward_compatible_choice → backward_compatible_choice), while line 46 shows the actual change (backward_compatible_choice → enable). The duplicate entry on line 44 should be removed as it provides no meaningful information and the actual change is already captured on line 46.
```suggestion

```

Code after:
{
    /// Forbid duplicate versions
    auto [_, inserted] = settings_changes_history.emplace(ClickHouseVersion(version), std::move(changes));
    if (!inserted)
        throw Exception{ErrorCodes::LOGICAL_ERROR, "Detected duplicate version '{}'", ClickHouseVersion(version).toString()};
}

const VersionToSettingsChangesMap & getSettingsChangesHistory()
{
    static VersionToSettingsChangesMap settings_changes_history;
    static std::once_flag initialized_flag;
    std::call_once(initialized_flag, [&]
    {
        // clang-format off
        /// History of settings changes that controls some backward incompatible changes
        /// across all ClickHouse versions. It maps ClickHouse version to settings changes that were done
        /// in this version. This history contains both changes to existing settings and newly added settings.
        /// Settings changes is a vector of structs
        ///     {setting_name, previous_value, new_value, reason}.
        /// For newly added setting choose the most appropriate previous_value (for example, if new setting
        /// controls new feature and it's 'true' by default, use 'false' as previous_value).
        /// It's used to implement `compatibility` setting (see https://github.com/ClickHouse/ClickHouse/issues/35972)
        /// Note: please check if the key already exists to prevent duplicate entries.
        addSettingsChanges(settings_changes_history, "26.2",
        {
            {"deduplicate_blocks_in_dependent_materialized_views", false, true, "Enable deduplication for dependent materialized views by default."},
            {"deduplicate_insert", "backward_compatible_choice", "enable", "Enable deduplication for all sync and async inserts by default."},
            {"use_parquet_metadata_cache", true, true, "Enables cache of parquet file metadata."},
            {"enable_join_runtime_filters", false, true, "Enabled this optimization"},
            {"parallel_replicas_filter_pushdown", false, false, "New setting"},
            {"use_page_cache_for_local_disks", false, false, "New setting to use userspace page cache for local disks"},
            {"use_page_cache_for_object_storage", false, false, "New setting to use userspace page cache for object storage table functions"},
            {"use_statistics_cache", false, true, "Enable statistics cache"},
        });
        addSettingsChanges(settings_changes_history, "26.1",
        {
            {"use_statistics", true, true, "Enable this optimization by default."},
            {"ignore_on_cluster_for_replicated_database", false, false, "Add a new setting to ignore ON CLUSTER clause for DDL queries with a replicated database."},
            {"input_format_binary_max_type_complexity", 1000, 1000, "Add a new setting to control max number of type nodes when decoding binary types. Protects against malicious inputs."},
            {"distributed_index_analysis", false, false, "New experimental setting"},
            {"distributed_index_analysis_for_non_shared_merge_tree", false, false, "New setting"},
            {"distributed_cache_file_cache_name", "", "", "New setting."},
            {"trace_profile_events_list", "", "", "New setting"},
            {"query_plan_reuse_storage_ordering_for_window_functions", true, false, "Disable this logic by default."},
            {"optimize_read_in_window_order", true, false, "Disable this logic by default."},
            {"correlated_subqueries_use_in_memory_buffer", false, true, "Use in-memory buffer for input of correlated subqueries by default."},
            {"allow_experimental_database_paimon_rest_catalog", false, false, "New setting"},
            {"allow_experimental_object_storage_queue_hive_partitioning", false, false, "New setting."},
            {"type_json_use_partial_match_to_skip_paths_by_regexp", false, true, "Add new setting that allows to use partial match in regexp paths skip in JSON type parsing"},
            {"max_insert_block_size_bytes", 0, 0, "New setting that allows to control the size of blocks in bytes during parsing of data in Row Input Format."},
            {"max_insert_block_size_rows", DEFAULT_INSERT_BLOCK_SIZE, DEFAULT_INSERT_BLOCK_SIZE, "An alias for max_insert_block_size."},