From a75559aa36117c48c0c016b56215cbc05d07459b Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sat, 30 Apr 2022 12:17:22 +0300 Subject: [PATCH] Avoid recreation of system.asynchronous_metric_log (due to difference in codec) From the log: 2022.04.29 12:33:40.397528 [ 486 ] {} SystemLog (system.asynchronous_metric_log): Existing table system.asynchronous_metric_log for system log has obsolete or different structure. Renaming it to asynchronous_metric_log_352. Old: CREATE TABLE system.asynchronous_metric_log (`event_date` Date CODEC(Delta(2), ZSTD(1)), `event_time` DateTime CODEC(Delta(4), ZSTD(1)), `metric` LowCardinality(String) CODEC(ZSTD(1)), `value` Float64 CODEC(Gorilla, ZSTD(3))) ENGINE = MergeTree PARTITION BY toYYYYMM(event_date) ORDER BY (metric, event_date, event_time) SETTINGS index_granularity = 8192 New: CREATE TABLE system.asynchronous_metric_log (`event_date` Date CODEC(Delta(2), ZSTD), `event_time` DateTime CODEC(Delta(4), ZSTD), `metric` LowCardinality(String) CODEC(ZSTD), `value` Float64 CODEC(Gorilla, ZSTD(3))) ENGINE = MergeTree PARTITION BY toYYYYMM(event_date) ORDER BY (metric, event_date, event_time) SETTINGS index_granularity = 8192 As you can see the difference in default ZSTD level. P.S. I decided not to fix the printer, since this may introduce changes in metadata, that may lead to changes in metadata between ZooKeeper and clickhouse server. Signed-off-by: Azat Khuzhin --- src/Interpreters/AsynchronousMetricLog.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Interpreters/AsynchronousMetricLog.h b/src/Interpreters/AsynchronousMetricLog.h index a31ab7eb146..836e967a7a6 100644 --- a/src/Interpreters/AsynchronousMetricLog.h +++ b/src/Interpreters/AsynchronousMetricLog.h @@ -37,9 +37,9 @@ struct AsynchronousMetricLogElement /// Otherwise the list will be constructed from LogElement::getNamesAndTypes and LogElement::getNamesAndAliases. static const char * getCustomColumnList() { - return "event_date Date CODEC(Delta(2), ZSTD), " - "event_time DateTime CODEC(Delta(4), ZSTD), " - "metric LowCardinality(String) CODEC(ZSTD), " + return "event_date Date CODEC(Delta(2), ZSTD(1)), " + "event_time DateTime CODEC(Delta(4), ZSTD(1)), " + "metric LowCardinality(String) CODEC(ZSTD(1)), " "value Float64 CODEC(Gorilla, ZSTD(3))"; } };