mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Merge pull request #58955 from ClickHouse/more_safe_way_to_dump_Logs
More safe way to dump system logs in tests
This commit is contained in:
commit
3dc8b2dbf7
@ -235,6 +235,17 @@ clickhouse-client -q "system flush logs" ||:
|
|||||||
# stop logs replication to make it possible to dump logs tables via clickhouse-local
|
# stop logs replication to make it possible to dump logs tables via clickhouse-local
|
||||||
stop_logs_replication
|
stop_logs_replication
|
||||||
|
|
||||||
|
# Try to get logs while server is running
|
||||||
|
successfuly_saved=0
|
||||||
|
for table in query_log zookeeper_log trace_log transactions_info_log
|
||||||
|
do
|
||||||
|
clickhouse-client -q "select * from system.$table format TSVWithNamesAndTypes" | zstd --threads=0 > /test_output/$table.tsv.zst || successfuly_saved=$((successfuly_saved+$?))
|
||||||
|
if [[ -n "$USE_DATABASE_REPLICATED" ]] && [[ "$USE_DATABASE_REPLICATED" -eq 1 ]]; then
|
||||||
|
clickhouse-client -q "select * from system.$table format TSVWithNamesAndTypes" | zstd --threads=0 > /test_output/$table.1.tsv.zst || successfuly_saved=$((successfuly_saved+$?))
|
||||||
|
clickhouse-client -q "select * from system.$table format TSVWithNamesAndTypes" | zstd --threads=0 > /test_output/$table.2.tsv.zst || successfuly_saved=$((successfuly_saved+$?))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# Stop server so we can safely read data with clickhouse-local.
|
# Stop server so we can safely read data with clickhouse-local.
|
||||||
# Why do we read data with clickhouse-local?
|
# Why do we read data with clickhouse-local?
|
||||||
# Because it's the simplest way to read it when server has crashed.
|
# Because it's the simplest way to read it when server has crashed.
|
||||||
@ -254,21 +265,25 @@ if [[ -n "$USE_S3_STORAGE_FOR_MERGE_TREE" ]] && [[ "$USE_S3_STORAGE_FOR_MERGE_TR
|
|||||||
data_path_config="--config-file=/etc/clickhouse-server/config.xml"
|
data_path_config="--config-file=/etc/clickhouse-server/config.xml"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Compress tables.
|
|
||||||
#
|
# If server crashed dump system logs with clickhouse-local
|
||||||
# NOTE:
|
if [ $successfuly_saved -ne 0 ]; then
|
||||||
# - that due to tests with s3 storage we cannot use /var/lib/clickhouse/data
|
# Compress tables.
|
||||||
# directly
|
#
|
||||||
# - even though ci auto-compress some files (but not *.tsv) it does this only
|
# NOTE:
|
||||||
# for files >64MB, we want this files to be compressed explicitly
|
# - that due to tests with s3 storage we cannot use /var/lib/clickhouse/data
|
||||||
for table in query_log zookeeper_log trace_log transactions_info_log
|
# directly
|
||||||
do
|
# - even though ci auto-compress some files (but not *.tsv) it does this only
|
||||||
clickhouse-local "$data_path_config" --only-system-tables -q "select * from system.$table format TSVWithNamesAndTypes" | zstd --threads=0 > /test_output/$table.tsv.zst ||:
|
# for files >64MB, we want this files to be compressed explicitly
|
||||||
if [[ -n "$USE_DATABASE_REPLICATED" ]] && [[ "$USE_DATABASE_REPLICATED" -eq 1 ]]; then
|
for table in query_log zookeeper_log trace_log transactions_info_log
|
||||||
clickhouse-local --path /var/lib/clickhouse1/ --only-system-tables -q "select * from system.$table format TSVWithNamesAndTypes" | zstd --threads=0 > /test_output/$table.1.tsv.zst ||:
|
do
|
||||||
clickhouse-local --path /var/lib/clickhouse2/ --only-system-tables -q "select * from system.$table format TSVWithNamesAndTypes" | zstd --threads=0 > /test_output/$table.2.tsv.zst ||:
|
clickhouse-local "$data_path_config" --only-system-tables -q "select * from system.$table format TSVWithNamesAndTypes" | zstd --threads=0 > /test_output/$table.tsv.zst ||:
|
||||||
fi
|
if [[ -n "$USE_DATABASE_REPLICATED" ]] && [[ "$USE_DATABASE_REPLICATED" -eq 1 ]]; then
|
||||||
done
|
clickhouse-local --path /var/lib/clickhouse1/ --only-system-tables -q "select * from system.$table format TSVWithNamesAndTypes" | zstd --threads=0 > /test_output/$table.1.tsv.zst ||:
|
||||||
|
clickhouse-local --path /var/lib/clickhouse2/ --only-system-tables -q "select * from system.$table format TSVWithNamesAndTypes" | zstd --threads=0 > /test_output/$table.2.tsv.zst ||:
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Also export trace log in flamegraph-friendly format.
|
# Also export trace log in flamegraph-friendly format.
|
||||||
for trace_type in CPU Memory Real
|
for trace_type in CPU Memory Real
|
||||||
|
Loading…
Reference in New Issue
Block a user