Added missing code

This commit is contained in:
Alexey Milovidov 2020-04-19 23:04:59 +03:00
parent 99667a38c3
commit 8d3e6ed5e3
4 changed files with 17 additions and 12 deletions

View File

@ -30,7 +30,8 @@ std::shared_ptr<TSystemLog> createSystemLog(
const String & default_database_name, const String & default_database_name,
const String & default_table_name, const String & default_table_name,
const Poco::Util::AbstractConfiguration & config, const Poco::Util::AbstractConfiguration & config,
const String & config_prefix) const String & config_prefix,
bool lazy_load)
{ {
if (!config.has(config_prefix)) if (!config.has(config_prefix))
return {}; return {};
@ -63,7 +64,7 @@ std::shared_ptr<TSystemLog> createSystemLog(
size_t flush_interval_milliseconds = config.getUInt64(config_prefix + ".flush_interval_milliseconds", DEFAULT_SYSTEM_LOG_FLUSH_INTERVAL_MILLISECONDS); size_t flush_interval_milliseconds = config.getUInt64(config_prefix + ".flush_interval_milliseconds", DEFAULT_SYSTEM_LOG_FLUSH_INTERVAL_MILLISECONDS);
return std::make_shared<TSystemLog>(context, database, table, engine, flush_interval_milliseconds); return std::make_shared<TSystemLog>(context, database, table, engine, flush_interval_milliseconds, lazy_load);
} }
} }
@ -71,12 +72,14 @@ std::shared_ptr<TSystemLog> createSystemLog(
SystemLogs::SystemLogs(Context & global_context, const Poco::Util::AbstractConfiguration & config) SystemLogs::SystemLogs(Context & global_context, const Poco::Util::AbstractConfiguration & config)
{ {
query_log = createSystemLog<QueryLog>(global_context, "system", "query_log", config, "query_log"); bool lazy_load = config.getBool("system_tables_lazy_load", true);
query_thread_log = createSystemLog<QueryThreadLog>(global_context, "system", "query_thread_log", config, "query_thread_log");
part_log = createSystemLog<PartLog>(global_context, "system", "part_log", config, "part_log"); query_log = createSystemLog<QueryLog>(global_context, "system", "query_log", config, "query_log", lazy_load);
trace_log = createSystemLog<TraceLog>(global_context, "system", "trace_log", config, "trace_log"); query_thread_log = createSystemLog<QueryThreadLog>(global_context, "system", "query_thread_log", config, "query_thread_log", lazy_load);
text_log = createSystemLog<TextLog>(global_context, "system", "text_log", config, "text_log"); part_log = createSystemLog<PartLog>(global_context, "system", "part_log", config, "part_log", lazy_load);
metric_log = createSystemLog<MetricLog>(global_context, "system", "metric_log", config, "metric_log"); trace_log = createSystemLog<TraceLog>(global_context, "system", "trace_log", config, "trace_log", lazy_load);
text_log = createSystemLog<TextLog>(global_context, "system", "text_log", config, "text_log", lazy_load);
metric_log = createSystemLog<MetricLog>(global_context, "system", "metric_log", config, "metric_log", lazy_load);
if (metric_log) if (metric_log)
{ {

View File

@ -117,7 +117,8 @@ public:
const String & database_name_, const String & database_name_,
const String & table_name_, const String & table_name_,
const String & storage_def_, const String & storage_def_,
size_t flush_interval_milliseconds_); size_t flush_interval_milliseconds_,
bool lazy_load);
/** Append a record into log. /** Append a record into log.
* Writing to table will be done asynchronously and in case of failure, record could be lost. * Writing to table will be done asynchronously and in case of failure, record could be lost.

View File

@ -72,9 +72,9 @@ void TextLogElement::appendToBlock(Block & block) const
TextLog::TextLog(Context & context_, const String & database_name_, TextLog::TextLog(Context & context_, const String & database_name_,
const String & table_name_, const String & storage_def_, const String & table_name_, const String & storage_def_,
size_t flush_interval_milliseconds_) size_t flush_interval_milliseconds_, bool lazy_load)
: SystemLog<TextLogElement>(context_, database_name_, table_name_, : SystemLog<TextLogElement>(context_, database_name_, table_name_,
storage_def_, flush_interval_milliseconds_) storage_def_, flush_interval_milliseconds_, lazy_load)
{ {
// SystemLog methods may write text logs, so we disable logging for the text // SystemLog methods may write text logs, so we disable logging for the text
// log table to avoid recursion. // log table to avoid recursion.

View File

@ -36,7 +36,8 @@ public:
const String & database_name_, const String & database_name_,
const String & table_name_, const String & table_name_,
const String & storage_def_, const String & storage_def_,
size_t flush_interval_milliseconds_); size_t flush_interval_milliseconds_,
bool lazy_load);
}; };
} }