Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Update run.sh

* Update run.sh
  • Loading branch information
tavplubix authored Sep 5, 2023
1 parent 8a1984a commit 735f543
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions docker/test/stateless/run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

# shellcheck disable=SC1091
# shellcheck disable=SC2034
source /setup_export_logs.sh

# fail on errors, verbose and export all env variables
Expand Down Expand Up @@ -216,6 +215,12 @@ rg -Fa "<Fatal>" /var/log/clickhouse-server/clickhouse-server.log ||:
rg -A50 -Fa "============" /var/log/clickhouse-server/stderr.log ||:
zstd --threads=0 < /var/log/clickhouse-server/clickhouse-server.log > /test_output/clickhouse-server.log.zst &

data_path_config="--path=/var/lib/clickhouse/"
if [[ -n "$USE_S3_STORAGE_FOR_MERGE_TREE" ]] && [[ "$USE_S3_STORAGE_FOR_MERGE_TREE" -eq 1 ]]; then
# We need s3 storage configuration (but it's more likely that clickhouse-local will fail for some reason)
data_path_config="--config-file=/etc/clickhouse-server/config.xml"
fi

# Compress tables.
#
# NOTE:
Expand All @@ -225,23 +230,17 @@ zstd --threads=0 < /var/log/clickhouse-server/clickhouse-server.log > /test_outp
# for files >64MB, we want this files to be compressed explicitly
for table in query_log zookeeper_log trace_log transactions_info_log
do
clickhouse-local --path /var/lib/clickhouse/ --only-system-tables -q "select * from system.$table format TSVWithNamesAndTypes" | zstd --threads=0 > /test_output/$table.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 ||:
if [[ -n "$USE_DATABASE_REPLICATED" ]] && [[ "$USE_DATABASE_REPLICATED" -eq 1 ]]; then
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

data_path_config="--path=/var/lib/clickhouse/"
if [[ -n "$USE_S3_STORAGE_FOR_MERGE_TREE" ]] && [[ "$USE_S3_STORAGE_FOR_MERGE_TREE" -eq 1 ]]; then
# We need s3 storage configuration (but it's more likely that clickhouse-local will fail for some reason)
data_path_config="--config-file=/etc/clickhouse-server/config.xml"
fi

# Also export trace log in flamegraph-friendly format.
for trace_type in CPU Memory Real
do
clickhouse-local "data_path_config" --only-system-tables -q "
clickhouse-local "$data_path_config" --only-system-tables -q "
select
arrayStringConcat((arrayMap(x -> concat(splitByChar('/', addressToLine(x))[-1], '#', demangle(addressToSymbol(x)) ), trace)), ';') AS stack,
count(*) AS samples
Expand Down

0 comments on commit 735f543

Please sign in to comment.