From 7f723eb7802b32e60c24bf7b7a6fb3d569ae6243 Mon Sep 17 00:00:00 2001 From: spongedc Date: Thu, 3 Dec 2020 00:45:17 +0800 Subject: [PATCH 1/2] add check for systemlog tables' engine definition --- src/Interpreters/SystemLog.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Interpreters/SystemLog.cpp b/src/Interpreters/SystemLog.cpp index 97d5cbb8eab..c917716f018 100644 --- a/src/Interpreters/SystemLog.cpp +++ b/src/Interpreters/SystemLog.cpp @@ -74,6 +74,9 @@ std::shared_ptr createSystemLog( engine += " TTL " + ttl; engine += " ORDER BY (event_date, event_time)"; } + ParserStorage storage_parser; + parseQuery(storage_parser, engine.data(), engine.data() + engine.size(), + "Storage to create table for " + config_prefix, 0, DBMS_DEFAULT_MAX_PARSER_DEPTH); size_t flush_interval_milliseconds = config.getUInt64(config_prefix + ".flush_interval_milliseconds", DEFAULT_SYSTEM_LOG_FLUSH_INTERVAL_MILLISECONDS); From b13c381d7eb91c692e2d18e11314602c19953a0a Mon Sep 17 00:00:00 2001 From: spongedc Date: Thu, 3 Dec 2020 01:02:37 +0800 Subject: [PATCH 2/2] add log for systemlog tables' engine definition check --- src/Interpreters/SystemLog.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Interpreters/SystemLog.cpp b/src/Interpreters/SystemLog.cpp index c917716f018..1667d845d77 100644 --- a/src/Interpreters/SystemLog.cpp +++ b/src/Interpreters/SystemLog.cpp @@ -74,6 +74,7 @@ std::shared_ptr createSystemLog( engine += " TTL " + ttl; engine += " ORDER BY (event_date, event_time)"; } + // Validate engine definition grammatically to prevent some configuration errors ParserStorage storage_parser; parseQuery(storage_parser, engine.data(), engine.data() + engine.size(), "Storage to create table for " + config_prefix, 0, DBMS_DEFAULT_MAX_PARSER_DEPTH);