From 0d037bc964cdfe44a0494f5dd3435014c594b362 Mon Sep 17 00:00:00 2001 From: Aris Tritas Date: Thu, 5 Dec 2024 21:46:01 +0100 Subject: [PATCH] clickhouse: allow restoring experimental MergeTree settings The two settings were introduced between v23.8 and v24.3. They are needed when restoring by clusters that have defined them at the table level. --- astacus/coordinator/plugins/clickhouse/steps.py | 2 ++ tests/unit/coordinator/plugins/clickhouse/test_steps.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/astacus/coordinator/plugins/clickhouse/steps.py b/astacus/coordinator/plugins/clickhouse/steps.py index 14f7e433..e5f88983 100644 --- a/astacus/coordinator/plugins/clickhouse/steps.py +++ b/astacus/coordinator/plugins/clickhouse/steps.py @@ -685,6 +685,8 @@ def _create_dbs(client: ClickHouseClient) -> Iterator[Awaitable[None]]: b"SET allow_hyperscan=true", b"SET allow_simdjson=true", b"SET allow_deprecated_syntax_for_merge_tree=true", + b"SET allow_experimental_block_number_column=true", + b"SET allow_experimental_replacing_merge_with_cleanup=true", # If a table was created with flatten_nested=0, we must be careful to not re-create the # table with flatten_nested=1, since this would recreate the table with a different schema. # If a table was created with flatten_nested=1, the query in system.tables.create_table_query diff --git a/tests/unit/coordinator/plugins/clickhouse/test_steps.py b/tests/unit/coordinator/plugins/clickhouse/test_steps.py index 623d924e..c232b3fb 100644 --- a/tests/unit/coordinator/plugins/clickhouse/test_steps.py +++ b/tests/unit/coordinator/plugins/clickhouse/test_steps.py @@ -890,6 +890,8 @@ async def test_creates_all_replicated_databases_and_tables_in_manifest() -> None b"SET allow_hyperscan=true", b"SET allow_simdjson=true", b"SET allow_deprecated_syntax_for_merge_tree=true", + b"SET allow_experimental_block_number_column=true", + b"SET allow_experimental_replacing_merge_with_cleanup=true", b"SET flatten_nested=0", b"CREATE TABLE db-one.table-uno ...", b"CREATE TABLE db-one.table-dos ...", @@ -964,6 +966,8 @@ async def test_creates_all_replicated_databases_and_tables_in_manifest_with_cust b"SET allow_hyperscan=true", b"SET allow_simdjson=true", b"SET allow_deprecated_syntax_for_merge_tree=true", + b"SET allow_experimental_block_number_column=true", + b"SET allow_experimental_replacing_merge_with_cleanup=true", b"SET flatten_nested=0", b"CREATE TABLE db-one.table-uno ...", b"CREATE TABLE db-one.table-dos ...", @@ -1023,6 +1027,8 @@ async def test_drops_each_database_on_all_servers_before_recreating_it() -> None b"SET allow_hyperscan=true", b"SET allow_simdjson=true", b"SET allow_deprecated_syntax_for_merge_tree=true", + b"SET allow_experimental_block_number_column=true", + b"SET allow_experimental_replacing_merge_with_cleanup=true", b"SET flatten_nested=0", b"CREATE TABLE db-one.table-uno ...", b"CREATE TABLE db-one.table-dos ...",