Add test and config changes for system.error_log

This commit is contained in:
Pablo Marcos 2024-06-18 08:23:42 +00:00
parent f10f266ea3
commit 216d26987a
25 changed files with 94 additions and 3 deletions

View File

@ -285,7 +285,7 @@ stop_logs_replication
# Try to get logs while server is running
failed_to_save_logs=0
for table in query_log zookeeper_log trace_log transactions_info_log metric_log blob_storage_log
for table in query_log zookeeper_log trace_log transactions_info_log metric_log blob_storage_log error_log
do
err=$(clickhouse-client -q "select * from system.$table into outfile '/test_output/$table.tsv.gz' format TSVWithNamesAndTypes")
echo "$err"
@ -339,7 +339,7 @@ if [ $failed_to_save_logs -ne 0 ]; then
# directly
# - even though ci auto-compress some files (but not *.tsv) it does this only
# for files >64MB, we want this files to be compressed explicitly
for table in query_log zookeeper_log trace_log transactions_info_log metric_log blob_storage_log
for table in query_log zookeeper_log trace_log transactions_info_log metric_log blob_storage_log error_log
do
clickhouse-local "$data_path_config" --only-system-tables --stacktrace -q "select * from system.$table format TSVWithNamesAndTypes" | zstd --threads=0 > /test_output/$table.tsv.zst ||:
if [[ -n "$USE_DATABASE_REPLICATED" ]] && [[ "$USE_DATABASE_REPLICATED" -eq 1 ]]; then

View File

@ -1155,7 +1155,7 @@
<flush_on_crash>false</flush_on_crash>
</metric_log>
<!-- Error log contains rows with current values of Errors collected with "collect_interval_milliseconds" interval. -->
<!-- Error log contains rows with current values of errors collected with "collect_interval_milliseconds" interval. -->
<error_log>
<database>system</database>
<table>error_log</table>

View File

@ -726,6 +726,13 @@ metric_log:
flush_interval_milliseconds: 7500
collect_interval_milliseconds: 1000
# Error log contains rows with current values of errors collected with "collect_interval_milliseconds" interval.
error_log:
database: system
table: error_log
flush_interval_milliseconds: 7500
collect_interval_milliseconds: 1000
# Asynchronous metric log contains values of metrics from
# system.asynchronous_metrics.
asynchronous_metric_log:

View File

@ -5,6 +5,7 @@
<query_log remove="remove" />
<query_views_log remove="remove" />
<metric_log remove="remove"/>
<error_log remove="remove"/>
<text_log remove="remove"/>
<trace_log remove="remove"/>
<asynchronous_metric_log remove="remove" />

View File

@ -1485,6 +1485,7 @@ def test_backup_all(exclude_system_log_tables):
"processors_profile_log",
"asynchronous_insert_log",
"backup_log",
"error_log",
]
exclude_from_backup += ["system." + table_name for table_name in log_tables]

View File

@ -0,0 +1,8 @@
<clickhouse>
<error_log>
<database>system</database>
<table>error_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<collect_interval_milliseconds>1000</collect_interval_milliseconds>
</error_log>
</clickhouse>

View File

@ -756,6 +756,14 @@
<collect_interval_milliseconds>1000</collect_interval_milliseconds>
</metric_log>
<!-- Error log contains rows with current values of errors collected with "collect_interval_milliseconds" interval. -->
<error_log>
<database>system</database>
<table>error_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<collect_interval_milliseconds>1000</collect_interval_milliseconds>
</error_log>
<!--
Asynchronous metric log contains values of metrics from
system.asynchronous_metrics.

View File

@ -9,6 +9,7 @@ def test_xml_full_conf():
all_confd = [
"configs/config.d/access_control.xml",
"configs/config.d/error_log.xml",
"configs/config.d/keeper_port.xml",
"configs/config.d/logging_no_rotate.xml",
"configs/config.d/log_to_console.xml",

View File

@ -0,0 +1,6 @@
error_log:
database: system
table: error_log
flush_interval_milliseconds: 7500
collect_interval_milliseconds: 1000

View File

@ -129,6 +129,13 @@
<collect_interval_milliseconds>1000</collect_interval_milliseconds>
</metric_log>
<error_log>
<database>system</database>
<table>error_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<collect_interval_milliseconds>1000</collect_interval_milliseconds>
</error_log>
<asynchronous_metric_log>
<database>system</database>
<table>asynchronous_metric_log</table>

View File

@ -9,6 +9,7 @@ def test_xml_main_conf():
all_confd = [
"configs/config.d/access_control.yaml",
"configs/config.d/error_log.yaml",
"configs/config.d/keeper_port.yaml",
"configs/config.d/logging_no_rotate.yaml",
"configs/config.d/log_to_console.yaml",

View File

@ -0,0 +1,8 @@
<clickhouse>
<error_log>
<database>system</database>
<table>error_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<collect_interval_milliseconds>1000</collect_interval_milliseconds>
</error_log>
</clickhouse>

View File

@ -129,6 +129,13 @@
<collect_interval_milliseconds>1000</collect_interval_milliseconds>
</metric_log>
<error_log>
<database>system</database>
<table>error_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<collect_interval_milliseconds>1000</collect_interval_milliseconds>
</error_log>
<asynchronous_metric_log>
<database>system</database>
<table>asynchronous_metric_log</table>

View File

@ -10,6 +10,7 @@ def test_extra_yaml_mix():
all_confd = [
"configs/config.d/0_common_instance_config.yaml",
"configs/config.d/access_control.yaml",
"configs/config.d/error_log.xml",
"configs/config.d/keeper_port.xml",
"configs/config.d/logging_no_rotate.xml",
"configs/config.d/log_to_console.yaml",

View File

@ -0,0 +1,6 @@
error_log:
database: system
table: error_log
flush_interval_milliseconds: 7500
collect_interval_milliseconds: 1000

View File

@ -90,6 +90,11 @@ metric_log:
table: metric_log
flush_interval_milliseconds: 7500
collect_interval_milliseconds: 1000
error_log:
database: system
table: error_log
flush_interval_milliseconds: 7500
collect_interval_milliseconds: 1000
asynchronous_metric_log:
database: system
table: asynchronous_metric_log

View File

@ -10,6 +10,7 @@ def test_yaml_full_conf():
all_confd = [
"configs/config.d/0_common_instance_config.yaml",
"configs/config.d/access_control.yaml",
"configs/config.d/error_log.yaml",
"configs/config.d/keeper_port.yaml",
"configs/config.d/logging_no_rotate.yaml",
"configs/config.d/log_to_console.yaml",

View File

@ -0,0 +1,8 @@
<clickhouse>
<error_log>
<database>system</database>
<table>error_log</table>
<flush_interval_milliseconds>7500</flush_interval_milliseconds>
<collect_interval_milliseconds>1000</collect_interval_milliseconds>
</error_log>
</clickhouse>

View File

@ -90,6 +90,11 @@ metric_log:
table: metric_log
flush_interval_milliseconds: 7500
collect_interval_milliseconds: 1000
error_log:
database: system
table: error_log
flush_interval_milliseconds: 7500
collect_interval_milliseconds: 1000
asynchronous_metric_log:
database: system
table: asynchronous_metric_log

View File

@ -10,6 +10,7 @@ def test_yaml_main_conf():
all_confd = [
"configs/config.d/0_common_instance_config.yaml",
"configs/config.d/access_control.xml",
"configs/config.d/error_log.xml",
"configs/config.d/keeper_port.xml",
"configs/config.d/logging_no_rotate.xml",
"configs/config.d/log_to_console.xml",

View File

@ -6,6 +6,7 @@
<query_log remove="remove" />
<query_views_log remove="remove" />
<metric_log remove="remove"/>
<error_log remove="remove"/>
<text_log remove="remove"/>
<trace_log remove="remove"/>
<asynchronous_metric_log remove="remove" />

View File

@ -21,6 +21,7 @@ system_logs = [
("system.part_log", 1),
("system.trace_log", 1),
("system.metric_log", 1),
("system.error_log", 1),
]

View File

@ -30,6 +30,7 @@ def test_system_logs_recreate():
"part_log",
"trace_log",
"metric_log",
"error_log",
]
node.query("SYSTEM FLUSH LOGS")

View File

@ -0,0 +1,5 @@
select sleep(2) format Null; --More than collect_interval_milliseconds
system flush logs;
select count()>0 from system.error_log