From 7b29af8b3564606582164d952fcd6135035cd9e0 Mon Sep 17 00:00:00 2001 From: Dmitry Potepalov Date: Wed, 9 Oct 2024 14:23:22 +0200 Subject: [PATCH] Ignore unknown experimental settings on restore Just in case we're running against an older CH version, ignore an experimental setting we cannot enable. --- astacus/coordinator/plugins/clickhouse/client.py | 1 + astacus/coordinator/plugins/clickhouse/steps.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/astacus/coordinator/plugins/clickhouse/client.py b/astacus/coordinator/plugins/clickhouse/client.py index d723ed1e..285eb863 100644 --- a/astacus/coordinator/plugins/clickhouse/client.py +++ b/astacus/coordinator/plugins/clickhouse/client.py @@ -25,6 +25,7 @@ async def execute(self, query: bytes, timeout: float | None = None, session_id: class ClickHouseClientQueryError(Exception): # If we have to handle more error types, we might consider adding proper # rich error types and not display numeric values to the end user. + UNKNOWN_SETTING = 115 SETTING_CONSTRAINT_VIOLATION = 452 def __init__( diff --git a/astacus/coordinator/plugins/clickhouse/steps.py b/astacus/coordinator/plugins/clickhouse/steps.py index ccf5b288..a5c72a73 100644 --- a/astacus/coordinator/plugins/clickhouse/steps.py +++ b/astacus/coordinator/plugins/clickhouse/steps.py @@ -666,9 +666,9 @@ def _create_dbs(client: ClickHouseClient) -> Iterator[Awaitable[None]]: try: await self.clients[0].execute(query, session_id=session_id) except ClickHouseClientQueryError as error: - if error.exception_code == error.SETTING_CONSTRAINT_VIOLATION: + if error.exception_code in (error.SETTING_CONSTRAINT_VIOLATION, error.UNKNOWN_SETTING): # If we can't set the option, that's fine, either it's not needed or it will fail later anyway - pass + logger.info("Could not enable experimental setting, skipped; full error: %s", error) else: raise