Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions src/Common/ClickHouseVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,45 @@ ClickHouseVersion::ClickHouseVersion(std::string_view version)
{
Strings split;
boost::split(split, version, [](char c){ return c == '.'; });
components.reserve(split.size());
if (split.empty())
throw Exception{ErrorCodes::BAD_ARGUMENTS, "Cannot parse ClickHouse version here: {}", version};

for (const auto & split_element : split)
/// A version is 2 to 4 numeric components, optionally followed by a build flavour suffix
/// (e.g. "26.1.3.20001.altinityantalya"), which is only valid after a full 4-component version.
if (split.back() == "altinityantalya" || split.back() == "altinitystable" || split.back() == "altinitytest")
{
suffix = split.back();
split.pop_back();
if (split.size() != 4)
throw Exception{ErrorCodes::BAD_ARGUMENTS, "Cannot parse ClickHouse version here: {}", version};
}
else if (split.size() < 2 || split.size() > 4)
throw Exception{ErrorCodes::BAD_ARGUMENTS, "Cannot parse ClickHouse version here: {}", version};

components.reserve(split.size());
for (const auto & token : split)
{
size_t component = 0;
ReadBufferFromString buf(split_element);
if (!tryReadIntText(component, buf) || !buf.eof())
ReadBufferFromString buf(token);
if (token.empty() || !tryReadIntText(component, buf) || !buf.eof())
throw Exception{ErrorCodes::BAD_ARGUMENTS, "Cannot parse ClickHouse version here: {}", version};
components.push_back(component);
}
}

String ClickHouseVersion::toString() const
{
return fmt::format("{}", fmt::join(components, "."));
String result = fmt::format("{}", fmt::join(components, "."));
if (!suffix.empty())
result += "." + suffix;
return result;
}

std::strong_ordering ClickHouseVersion::operator<=>(const ClickHouseVersion & other) const
{
if (auto cmp = components <=> other.components; cmp != 0)
return cmp;
return suffix <=> other.suffix;
}

}
5 changes: 4 additions & 1 deletion src/Common/ClickHouseVersion.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <compare>
#include <string>
#include <vector>
#include <string_view>

Expand All @@ -14,10 +15,12 @@ class ClickHouseVersion

std::string toString() const;

std::strong_ordering operator<=>(const ClickHouseVersion & other) const = default;
std::strong_ordering operator<=>(const ClickHouseVersion & other) const;

private:
std::vector<size_t> components;
/// Non-numeric suffix (e.g. "altinityantalya" for "26.1.3.20001.altinityantalya"); empty for standard versions
std::string suffix;
};

}
26 changes: 26 additions & 0 deletions src/Common/tests/gtest_ch_version.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <gtest/gtest.h>
#include <Common/ClickHouseVersion.h>
#include <Common/Exception.h>

using namespace DB;

TEST(ClickHouseVersion, Accepts)
{
EXPECT_EQ(ClickHouseVersion("26.6").toString(), "26.6");
EXPECT_EQ(ClickHouseVersion("18.12.17").toString(), "18.12.17");
EXPECT_EQ(ClickHouseVersion("26.3.1.20001").toString(), "26.3.1.20001");
EXPECT_EQ(ClickHouseVersion("26.1.3.20001.altinityantalya").toString(), "26.1.3.20001.altinityantalya");
EXPECT_EQ(ClickHouseVersion("26.1.3.20001.altinitystable").toString(), "26.1.3.20001.altinitystable");
EXPECT_EQ(ClickHouseVersion("26.1.3.20001.altinitytest").toString(), "26.1.3.20001.altinitytest");
}

TEST(ClickHouseVersion, Rejects)
{
EXPECT_THROW(ClickHouseVersion(""), Exception); /// empty
EXPECT_THROW(ClickHouseVersion("26"), Exception); /// too few components
EXPECT_THROW(ClickHouseVersion("26.3.1.20001.1"), Exception); /// too many components
EXPECT_THROW(ClickHouseVersion("26..1"), Exception); /// empty component
EXPECT_THROW(ClickHouseVersion("26.x"), Exception); /// non-numeric component
EXPECT_THROW(ClickHouseVersion("26.altinityantalya"), Exception); /// suffix without a full version
EXPECT_THROW(ClickHouseVersion("26.3.1.20001.altinitycloud"), Exception); /// unknown suffix
}
46 changes: 46 additions & 0 deletions src/Core/SettingsChangesHistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ const VersionToSettingsChangesMap & getSettingsChangesHistory()
/// 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.8.1.20001.altinityantalya",
{
});
addSettingsChanges(settings_changes_history, "26.8",
{
{"adaptive_aggregator_freeze_threshold_bytes", 4194304, 4194304, "New setting bounding the adaptive aggregator's frozen local tables in bytes, whichever of it and the key-count threshold is reached first; 0 disables the byte bound."},
Expand Down Expand Up @@ -439,6 +442,16 @@ const VersionToSettingsChangesMap & getSettingsChangesHistory()
{"opentelemetry_start_keeper_trace_probability", "auto", "auto", "New setting"},
{"functions_h3_default_if_invalid", true, false, "A new setting for legacy behaviour to allow invalid inputs to h3 functions"},
});
addSettingsChanges(settings_changes_history, "26.1.3.20001.altinityantalya",
{
// {"iceberg_partition_timezone", "", "", "New setting."},
// {"s3_propagate_credentials_to_other_storages", false, false, "New setting"},
// {"export_merge_tree_part_filename_pattern", "", "{part_name}_{checksum}", "New setting"},
// {"use_parquet_metadata_cache", false, true, "Enables cache of parquet file metadata."},
// {"input_format_parquet_use_metadata_cache", true, false, "Obsolete. No-op"}, // https://github.com/Altinity/ClickHouse/pull/586
// {"object_storage_remote_initiator_cluster", "", "", "New setting."},
// {"iceberg_metadata_staleness_ms", 0, 0, "New setting allowing using cached metadata version at READ operations to prevent fetching from remote catalog"},
});
addSettingsChanges(settings_changes_history, "26.1",
{
{"use_statistics", true, true, "Enable this optimization by default."},
Expand Down Expand Up @@ -617,6 +630,39 @@ const VersionToSettingsChangesMap & getSettingsChangesHistory()
{"os_threads_nice_value_materialized_view", 0, 0, "New setting."},
{"os_thread_priority", 0, 0, "Alias for os_threads_nice_value_query."},
});
addSettingsChanges(settings_changes_history, "25.8.16.20001.altinityantalya",
{
// {"allow_experimental_database_iceberg", false, true, "Turned ON by default for Antalya."},
// {"allow_experimental_database_unity_catalog", false, true, "Turned ON by default for Antalya."},
// {"allow_experimental_database_glue_catalog", false, true, "Turned ON by default for Antalya."},
// {"allow_database_iceberg", false, true, "Turned ON by default for Antalya (alias)."},
// {"allow_database_unity_catalog", false, true, "Turned ON by default for Antalya (alias)."},
// {"allow_database_glue_catalog", false, true, "Turned ON by default for Antalya (alias)."},
// {"input_format_parquet_use_metadata_cache", true, true, "New setting, turned ON by default"}, // https://github.com/Altinity/ClickHouse/pull/586
// {"iceberg_timezone_for_timestamptz", "UTC", "UTC", "New setting."},
// {"object_storage_remote_initiator", false, false, "New setting."},
// {"allow_experimental_iceberg_read_optimization", true, true, "New setting."},
// {"object_storage_cluster_join_mode", "allow", "allow", "New setting"},
// {"lock_object_storage_task_distribution_ms", 500, 500, "New setting."},
// {"allow_retries_in_cluster_requests", false, false, "New setting"},
// {"allow_experimental_export_merge_tree_part", false, true, "Turned ON by default for Antalya."},
// {"export_merge_tree_part_overwrite_file_if_exists", false, false, "New setting."},
// {"export_merge_tree_partition_force_export", false, false, "New setting."},
// {"export_merge_tree_partition_max_retries", 3, 3, "New setting."},
// {"export_merge_tree_partition_manifest_ttl", 180, 180, "New setting."},
// {"export_merge_tree_part_file_already_exists_policy", "skip", "skip", "New setting."},
// {"hybrid_table_auto_cast_columns", true, true, "New setting to automatically cast Hybrid table columns when segments disagree on types. Default enabled."},
// {"allow_experimental_hybrid_table", false, false, "Added new setting to allow the Hybrid table engine."},
// {"enable_alias_marker", true, true, "New setting."},
// {"export_merge_tree_part_max_bytes_per_file", 0, 0, "New setting."},
// {"export_merge_tree_part_max_rows_per_file", 0, 0, "New setting."},
// {"export_merge_tree_partition_lock_inside_the_task", false, false, "New setting."},
// {"export_merge_tree_partition_system_table_prefer_remote_information", true, true, "New setting."},
// {"export_merge_tree_part_throw_on_pending_mutations", true, true, "New setting."},
// {"export_merge_tree_part_throw_on_pending_patch_parts", true, true, "New setting."},
// {"object_storage_cluster", "", "", "Antalya: New setting"},
// {"object_storage_max_nodes", 0, 0, "Antalya: New setting"},
});
addSettingsChanges(settings_changes_history, "25.8",
{
{"output_format_json_quote_64bit_integers", true, false, "Disable quoting of the 64 bit integers in JSON by default"},
Expand Down
Loading
Loading