2019-12-26 17:35:41 +00:00
#!/bin/bash
set -ex
set -o pipefail
trap "exit" INT TERM
trap "kill 0" EXIT
2020-02-27 20:02:50 +00:00
stage = ${ stage :- }
2019-12-26 19:16:36 +00:00
script_dir = " $( cd " $( dirname " ${ BASH_SOURCE [0] } " ) " >/dev/null 2>& 1 && pwd ) "
2019-12-26 17:35:41 +00:00
mkdir db0 || :
left_pr = $1
left_sha = $2
right_pr = $3
right_sha = $4
2020-02-21 19:58:52 +00:00
datasets = ${ CHPC_DATASETS :- "hits1 hits10 hits100 values" }
declare -A dataset_paths
dataset_paths[ "hits10" ] = "https://s3.mds.yandex.net/clickhouse-private-datasets/hits_10m_single/partitions/hits_10m_single.tar"
dataset_paths[ "hits100" ] = "https://s3.mds.yandex.net/clickhouse-private-datasets/hits_100m_single/partitions/hits_100m_single.tar"
dataset_paths[ "hits1" ] = "https://clickhouse-datasets.s3.yandex.net/hits/partitions/hits_v1.tar"
dataset_paths[ "values" ] = "https://clickhouse-datasets.s3.yandex.net/values_with_expressions/partitions/test_values.tar"
2019-12-26 17:35:41 +00:00
function download
{
2019-12-26 21:33:10 +00:00
rm -r left || :
mkdir left || :
rm -r right || :
mkdir right || :
2020-01-21 13:42:12 +00:00
# might have the same version on left and right
2020-02-14 19:11:46 +00:00
if ! [ " $left_sha " = " $right_sha " ]
2020-01-21 13:42:12 +00:00
then
2020-02-14 19:11:46 +00:00
wget -nv -nd -c " https://clickhouse-builds.s3.yandex.net/ $left_pr / $left_sha /performance/performance.tgz " -O- | tar -C left --strip-components= 1 -zxv &
wget -nv -nd -c " https://clickhouse-builds.s3.yandex.net/ $right_pr / $right_sha /performance/performance.tgz " -O- | tar -C right --strip-components= 1 -zxv &
2020-01-21 13:42:12 +00:00
else
2020-02-20 16:28:21 +00:00
wget -nv -nd -c " https://clickhouse-builds.s3.yandex.net/ $left_pr / $left_sha /performance/performance.tgz " -O- | tar -C left --strip-components= 1 -zxv && cp -a left right &
2020-01-21 13:42:12 +00:00
fi
2020-02-21 19:58:52 +00:00
for dataset_name in $datasets
do
dataset_path = " ${ dataset_paths [ $dataset_name ] } "
[ " $dataset_path " != "" ]
cd db0 && wget -nv -nd -c " $dataset_path " -O- | tar -xv &
done
2020-02-20 16:28:21 +00:00
2020-02-21 19:58:52 +00:00
mkdir ~/fg || :
cd ~/fg && wget -nv -nd -c "https://raw.githubusercontent.com/brendangregg/FlameGraph/master/flamegraph.pl" && chmod +x ~/fg/flamegraph.pl &
2020-02-20 16:28:21 +00:00
2019-12-26 17:35:41 +00:00
wait
}
function configure
{
2020-02-25 19:51:09 +00:00
# Use the new config for both servers, so that we can change it in a PR.
2019-12-26 17:35:41 +00:00
2020-02-14 12:55:47 +00:00
mkdir right/config/users.d || :
2020-02-25 19:51:09 +00:00
mkdir right/config/config.d || :
2020-02-14 12:55:47 +00:00
2020-02-25 19:51:09 +00:00
# FIXME delete these two configs when the performance.tgz with configs rolls out.
2020-02-14 12:55:47 +00:00
cat > right/config/config.d/zz-perf-test-tweaks-config.xml <<EOF
2019-12-26 17:35:41 +00:00
<yandex>
<logger>
<console>true</console>
</logger>
2019-12-26 21:33:10 +00:00
<text_log remove = "remove" >
<table remove = "remove" />
</text_log>
2020-02-25 12:18:50 +00:00
<use_uncompressed_cache>0</use_uncompressed_cache>
2020-02-22 17:52:49 +00:00
<!--1 GB-->
<uncompressed_cache_size>1000000000</uncompressed_cache_size>
2019-12-26 17:35:41 +00:00
</yandex>
EOF
2020-02-14 12:55:47 +00:00
cat > right/config/users.d/zz-perf-test-tweaks-users.xml <<EOF
<yandex>
<profiles>
<default>
<query_profiler_real_time_period_ns>10000000</query_profiler_real_time_period_ns>
<query_profiler_cpu_time_period_ns>0</query_profiler_cpu_time_period_ns>
<allow_introspection_functions>1</allow_introspection_functions>
2020-02-17 19:32:40 +00:00
<log_queries>1</log_queries>
2020-02-14 12:55:47 +00:00
</default>
</profiles>
</yandex>
EOF
2019-12-26 21:33:10 +00:00
rm right/config/config.d/text_log.xml || :
2020-01-14 19:05:58 +00:00
2020-02-25 19:51:09 +00:00
cp -rv right/config left || :
sed -i 's/<tcp_port>9000/<tcp_port>9001/g' left/config/config.xml
sed -i 's/<tcp_port>9000/<tcp_port>9002/g' right/config/config.xml
2020-01-14 19:05:58 +00:00
# Start a temporary server to rename the tables
2020-02-21 19:58:52 +00:00
while killall clickhouse; do echo . ; sleep 1 ; done
2020-01-14 19:05:58 +00:00
echo all killed
set -m # Spawn temporary in its own process groups
2020-02-14 19:11:46 +00:00
left/clickhouse server --config-file= left/config/config.xml -- --path db0 & > setup-server-log.log &
2020-01-14 19:05:58 +00:00
left_pid = $!
kill -0 $left_pid
disown $left_pid
set +m
while ! left/clickhouse client --port 9001 --query "select 1" ; do kill -0 $left_pid ; echo . ; sleep 1 ; done
echo server for setup started
left/clickhouse client --port 9001 --query "create database test" || :
left/clickhouse client --port 9001 --query "rename table datasets.hits_v1 to test.hits" || :
2020-02-14 12:55:47 +00:00
2020-02-21 19:58:52 +00:00
while killall clickhouse; do echo . ; sleep 1 ; done
2020-02-14 12:55:47 +00:00
echo all killed
# Remove logs etc, because they will be updated, and sharing them between
# servers with hardlink might cause unpredictable behavior.
rm db0/data/system/* -rf || :
2020-02-21 19:58:52 +00:00
rm db0/metadata/system/* -rf || :
2019-12-26 17:35:41 +00:00
2020-01-14 19:05:58 +00:00
# Make copies of the original db for both servers. Use hardlinks instead
# of copying.
rm -r left/db || :
rm -r right/db || :
cp -al db0/ left/db/
cp -al db0/ right/db/
2020-02-25 19:51:09 +00:00
}
function restart
{
while killall clickhouse; do echo . ; sleep 1 ; done
echo all killed
2020-01-14 19:05:58 +00:00
set -m # Spawn servers in their own process groups
2019-12-26 17:35:41 +00:00
2020-02-25 19:51:09 +00:00
left/clickhouse server --config-file= left/config/config.xml -- --path left/db & >> left-server-log.log &
2019-12-26 17:35:41 +00:00
left_pid = $!
kill -0 $left_pid
disown $left_pid
2020-02-25 19:51:09 +00:00
right/clickhouse server --config-file= right/config/config.xml -- --path right/db & >> right-server-log.log &
2019-12-26 17:35:41 +00:00
right_pid = $!
kill -0 $right_pid
disown $right_pid
set +m
2020-01-14 19:05:58 +00:00
while ! left/clickhouse client --port 9001 --query "select 1" ; do kill -0 $left_pid ; echo . ; sleep 1 ; done
2019-12-26 17:35:41 +00:00
echo left ok
2020-01-14 19:05:58 +00:00
while ! right/clickhouse client --port 9002 --query "select 1" ; do kill -0 $right_pid ; echo . ; sleep 1 ; done
2019-12-26 17:35:41 +00:00
echo right ok
2019-12-26 21:33:10 +00:00
2020-01-14 19:05:58 +00:00
left/clickhouse client --port 9001 --query "select * from system.tables where database != 'system'"
right/clickhouse client --port 9002 --query "select * from system.tables where database != 'system'"
2019-12-26 17:35:41 +00:00
}
2019-12-26 19:16:36 +00:00
function run_tests
{
# Just check that the script runs at all
" $script_dir /perf.py " --help > /dev/null
2020-02-28 20:40:26 +00:00
for x in { test-times,skipped-tests} .tsv
do
rm -v " $x " || :
touch " $x "
done
2020-02-06 12:46:57 +00:00
2020-01-16 19:39:07 +00:00
# FIXME remove some broken long tests
2020-02-05 20:06:23 +00:00
rm right/performance/{ IPv4,IPv6,modulo,parse_engine_file,number_formatting_formats,select_format} .xml || :
2020-01-14 19:05:58 +00:00
2020-02-27 20:02:50 +00:00
test_files = $( ls right/performance/*.xml)
2020-02-14 12:55:47 +00:00
# FIXME a quick crutch to bring the run time down for the flappy tests --
2020-02-21 19:58:52 +00:00
# if some performance tests xmls were changed in a PR, run only these ones.
if [ " $PR_TO_TEST " != "0" ]
2020-02-14 12:55:47 +00:00
then
2020-02-25 19:51:09 +00:00
test_files_override = $( sed 's/dbms\/tests/right/' changed-tests.txt)
2020-02-21 19:58:52 +00:00
if [ " $test_files_override " != "" ]
2020-02-14 12:55:47 +00:00
then
2020-02-14 19:11:46 +00:00
test_files = $test_files_override
2020-02-14 12:55:47 +00:00
fi
fi
# Run only explicitly specified tests, if any
if [ -v CHPC_TEST_GLOB ]
then
2020-02-27 20:02:50 +00:00
# I do want to expand the globs in the variable.
# shellcheck disable=SC2086
test_files = $( ls right/performance/$CHPC_TEST_GLOB .xml)
2020-02-14 12:55:47 +00:00
fi
2020-02-25 19:51:09 +00:00
# Run the tests.
test_name = "<none>"
2020-02-14 12:55:47 +00:00
for test in $test_files
2019-12-26 19:16:36 +00:00
do
2020-02-25 19:51:09 +00:00
# Check that both servers are alive, to fail faster if they die.
left/clickhouse client --port 9001 --query "select 1 format Null" \
|| { echo $test_name >> left-server-died.log ; restart ; continue ; }
right/clickhouse client --port 9002 --query "select 1 format Null" \
|| { echo $test_name >> right-server-died.log ; restart ; continue ; }
2020-02-27 20:02:50 +00:00
test_name = $( basename " $test " ".xml" )
echo test " $test_name "
2020-02-14 19:11:46 +00:00
2020-02-06 12:46:57 +00:00
TIMEFORMAT = $( printf " $test_name \t%%3R\t%%3U\t%%3S\n " )
2020-02-11 15:01:16 +00:00
# the grep is to filter out set -x output and keep only time output
{ time " $script_dir /perf.py " " $test " > " $test_name -raw.tsv " 2> " $test_name -err.log " ; } 2>& 1 >/dev/null | grep -v ^+ >> "wall-clock-times.tsv" || continue
2020-02-14 19:11:46 +00:00
2020-03-02 17:05:53 +00:00
# The test completed with zero status, so we treat stderr as warnings
mv " $test_name -err.log " " $test_name -warn.log "
2020-01-16 19:39:07 +00:00
grep ^query " $test_name -raw.tsv " | cut -f2- > " $test_name -queries.tsv "
grep ^client-time " $test_name -raw.tsv " | cut -f2- > " $test_name -client-time.tsv "
2020-02-28 16:22:07 +00:00
skipped = $( grep ^skipped " $test_name -raw.tsv " | cut -f2-)
if [ " $skipped " != "" ]
then
printf " $test_name " "\t" " $skipped " "\n" >> skipped-tests.tsv
fi
2019-12-26 19:16:36 +00:00
done
2020-02-14 12:55:47 +00:00
2020-02-14 19:11:46 +00:00
unset TIMEFORMAT
2020-02-14 12:55:47 +00:00
wait
2020-02-14 19:11:46 +00:00
}
2020-02-14 12:55:47 +00:00
2020-02-14 19:11:46 +00:00
function get_profiles
{
2020-02-14 12:55:47 +00:00
# Collect the profiles
2020-02-14 19:11:46 +00:00
left/clickhouse client --port 9001 --query "set query_profiler_cpu_time_period_ns = 0"
left/clickhouse client --port 9001 --query "set query_profiler_real_time_period_ns = 0"
right/clickhouse client --port 9001 --query "set query_profiler_cpu_time_period_ns = 0"
right/clickhouse client --port 9001 --query "set query_profiler_real_time_period_ns = 0"
2020-02-17 19:32:40 +00:00
left/clickhouse client --port 9001 --query "select * from system.query_log where type = 2 format TSVWithNamesAndTypes" > left-query-log.tsv || : &
2020-02-14 12:55:47 +00:00
left/clickhouse client --port 9001 --query "select * from system.trace_log format TSVWithNamesAndTypes" > left-trace-log.tsv || : &
left/clickhouse client --port 9001 --query "select arrayJoin(trace) addr, concat(splitByChar('/', addressToLine(addr))[-1], '#', demangle(addressToSymbol(addr)) ) name from system.trace_log group by addr format TSVWithNamesAndTypes" > left-addresses.tsv || : &
2020-02-25 19:51:09 +00:00
left/clickhouse client --port 9001 --query "select * from system.metric_log format TSVWithNamesAndTypes" > left-metric-log.tsv || : &
2020-02-17 19:32:40 +00:00
right/clickhouse client --port 9002 --query "select * from system.query_log where type = 2 format TSVWithNamesAndTypes" > right-query-log.tsv || : &
2020-02-14 12:55:47 +00:00
right/clickhouse client --port 9002 --query "select * from system.trace_log format TSVWithNamesAndTypes" > right-trace-log.tsv || : &
right/clickhouse client --port 9002 --query "select arrayJoin(trace) addr, concat(splitByChar('/', addressToLine(addr))[-1], '#', demangle(addressToSymbol(addr)) ) name from system.trace_log group by addr format TSVWithNamesAndTypes" > right-addresses.tsv || : &
2020-02-25 19:51:09 +00:00
right/clickhouse client --port 9002 --query "select * from system.metric_log format TSVWithNamesAndTypes" > right-metric-log.tsv || : &
2020-02-14 12:55:47 +00:00
wait
2019-12-26 19:16:36 +00:00
}
2019-12-26 17:35:41 +00:00
2020-03-02 18:47:37 +00:00
# Build and analyze randomization distribution for all queries.
function analyze_queries
{
ls ./*-queries.tsv | xargs -n1 -I% basename % -queries.tsv | \
parallel --verbose right/clickhouse local --file "{}-queries.tsv" \
--structure "\"query text, run int, version UInt32, time float\"" \
--query " \" $( cat " $script_dir /eqmed.sql " ) \" " \
">" { } -report.tsv
}
2019-12-26 19:16:36 +00:00
# Analyze results
2020-02-07 18:34:24 +00:00
function report
{
2020-02-17 19:32:40 +00:00
2020-02-25 19:51:09 +00:00
for x in { right,left} -{ addresses,{ query,trace,metric} -log} .tsv
2020-02-17 19:32:40 +00:00
do
# FIXME This loop builds column definitons from TSVWithNamesAndTypes in an
# absolutely atrocious way. This should be done by the file() function itself.
paste -d' ' \
2020-02-20 16:28:21 +00:00
<( sed -n '1{s/\t/\n/g;p;q}' " $x " | sed 's/\(^.*$\)/"\1"/' ) \
<( sed -n '2{s/\t/\n/g;p;q}' " $x " ) \
2020-02-17 19:32:40 +00:00
| tr '\n' ', ' | sed 's/,$//' > " $x .columns "
done
2020-02-27 20:02:50 +00:00
rm ./*.{ rep,svg} test-times.tsv test-dump.tsv unstable.tsv unstable-query-ids.tsv unstable-query-metrics.tsv changed-perf.tsv unstable-tests.tsv unstable-queries.tsv bad-tests.tsv slow-on-client.tsv all-queries.tsv || :
2020-02-17 19:32:40 +00:00
2020-02-07 18:34:24 +00:00
right/clickhouse local --query "
create table queries engine Memory as select
replaceAll( _file, '-report.tsv' , '' ) test,
2020-02-28 19:59:59 +00:00
2020-02-11 20:00:53 +00:00
-- FIXME Comparison mode doesn' t make sense for queries that complete
-- immediately, so for now we pretend they don't exist. We don' t want to
-- remove them altogether because we want to be able to detect regressions,
-- but the right way to do this is not yet clear.
2020-02-28 19:59:59 +00:00
left + right < 0.01 as short,
2020-02-28 17:08:51 +00:00
not short and abs( diff) < 0.10 and rd[ 3] > 0.10 as unstable,
2020-02-28 19:59:59 +00:00
-- Do not consider changed the queries with 5% RD below 1% -- e.g., we' re
-- likely to observe a difference > 1% in less than 5% cases.
-- Not sure it is correct, but empirically it filters out a lot of noise.
not short and abs( diff) > 0.15 and abs( diff) > rd[ 3] and rd[ 1] > 0.01 as changed,
2020-02-07 18:34:24 +00:00
*
2020-02-11 20:00:53 +00:00
from file( '*-report.tsv' , TSV, 'left float, right float, diff float, rd Array(float), query text' ) ;
2020-02-07 18:34:24 +00:00
2020-02-10 16:34:07 +00:00
create table changed_perf_tsv engine File( TSV, 'changed-perf.tsv' ) as
select left, right, diff, rd, test, query from queries where changed
order by rd[ 3] desc;
2020-02-11 20:00:53 +00:00
2020-02-10 16:34:07 +00:00
create table unstable_queries_tsv engine File( TSV, 'unstable-queries.tsv' ) as
2020-03-02 15:55:07 +00:00
select left, right, diff, rd, test, query from queries where unstable
2020-02-10 16:34:07 +00:00
order by rd[ 3] desc;
2020-02-11 20:00:53 +00:00
2020-02-10 16:34:07 +00:00
create table unstable_tests_tsv engine File( TSV, 'bad-tests.tsv' ) as
select test, sum( unstable) u, sum( changed) c, u + c s from queries
2020-02-07 18:34:24 +00:00
group by test having s > 0 order by s desc;
2020-02-10 16:34:07 +00:00
create table query_time engine Memory as select *, replaceAll( _file, '-client-time.tsv' , '' ) test
2020-02-07 18:34:24 +00:00
from file( '*-client-time.tsv' , TSV, 'query text, client float, server float' ) ;
2020-02-10 16:34:07 +00:00
create table wall_clock engine Memory as select *
from file( 'wall-clock-times.tsv' , TSV, 'test text, real float, user float, system float' ) ;
2020-02-07 18:34:24 +00:00
create table slow_on_client_tsv engine File( TSV, 'slow-on-client.tsv' ) as
2020-02-10 16:34:07 +00:00
select client, server, floor( client/server, 3) p, query
from query_time where p > 1.02 order by p desc;
create table test_time engine Memory as
2020-02-11 15:01:16 +00:00
select test, sum( client) total_client_time,
2020-02-11 20:00:53 +00:00
maxIf( client, not short) query_max,
minIf( client, not short) query_min,
count( *) queries,
sum( short) short_queries
from query_time, queries
where query_time.query = queries.query
2020-02-11 15:01:16 +00:00
group by test;
2020-02-07 18:34:24 +00:00
create table test_times_tsv engine File( TSV, 'test-times.tsv' ) as
2020-02-11 15:01:16 +00:00
select wall_clock.test, real,
floor( total_client_time, 3) ,
queries,
2020-02-11 20:00:53 +00:00
short_queries,
2020-02-11 15:01:16 +00:00
floor( query_max, 3) ,
floor( real / queries, 3) avg_real_per_query,
floor( query_min, 3)
2020-02-11 20:00:53 +00:00
from test_time join wall_clock using test
2020-02-14 12:55:47 +00:00
order by avg_real_per_query desc;
2020-02-10 16:34:07 +00:00
create table all_queries_tsv engine File( TSV, 'all-queries.tsv' ) as
select left, right, diff, rd, test, query
from queries order by rd[ 3] desc;
2020-02-17 19:32:40 +00:00
create view right_query_log as select *
from file( 'right-query-log.tsv' , TSVWithNamesAndTypes, '$(cat right-query-log.tsv.columns)' ) ;
create view right_trace_log as select *
from file( 'right-trace-log.tsv' , TSVWithNamesAndTypes, '$(cat right-trace-log.tsv.columns)' ) ;
2020-02-20 16:28:21 +00:00
create view right_addresses_src as select *
2020-02-17 19:32:40 +00:00
from file( 'right-addresses.tsv' , TSVWithNamesAndTypes, '$(cat right-addresses.tsv.columns)' ) ;
2020-02-20 16:28:21 +00:00
create table right_addresses_join engine Join( any, left, address) as
select addr address, name from right_addresses_src;
create table unstable_query_runs engine File( TSVWithNamesAndTypes, 'unstable-query-runs.rep' ) as
select query_id, query from right_query_log
2020-03-02 15:55:07 +00:00
join queries using query
where query_id not like 'prewarm %' and ( unstable or changed)
2020-02-17 19:32:40 +00:00
;
2020-02-20 16:28:21 +00:00
create table unstable_query_log engine File( Vertical, 'unstable-query-log.rep' ) as
select * from right_query_log
where query_id in ( select query_id from unstable_query_runs) ;
create table unstable_run_metrics engine File( TSVWithNamesAndTypes, 'unstable-run-metrics.rep' ) as
2020-02-17 19:32:40 +00:00
select ProfileEvents.Values value, ProfileEvents.Names metric, query_id, query
from right_query_log array join ProfileEvents
2020-02-20 16:28:21 +00:00
where query_id in ( select query_id from unstable_query_runs)
2020-02-17 19:32:40 +00:00
;
2020-02-20 16:28:21 +00:00
create table unstable_run_metrics_2 engine File( TSVWithNamesAndTypes, 'unstable-run-metrics-2.rep' ) as
select v, n, query_id, query
from
( select
[ 'memory_usage' , 'read_bytes' , 'written_bytes' ] n,
[ memory_usage, read_bytes, written_bytes] v,
query,
query_id
from right_query_log
where query_id in ( select query_id from unstable_query_runs) )
array join n, v;
create table unstable_run_traces engine File( TSVWithNamesAndTypes, 'unstable-run-traces.rep' ) as
select count( ) value, joinGet( right_addresses_join, 'name' , arrayJoin( trace) ) metric,
unstable_query_runs.query_id, any( unstable_query_runs.query) query
from unstable_query_runs
join right_trace_log on right_trace_log.query_id = unstable_query_runs.query_id
group by unstable_query_runs.query_id, metric
2020-02-17 19:32:40 +00:00
order by count( ) desc
;
create table metric_devation engine File( TSVWithNamesAndTypes, 'metric-deviation.rep' ) as
select floor( ( q[ 3] - q[ 1] ) /q[ 2] , 3) d,
2020-02-20 16:28:21 +00:00
quantilesExact( 0, 0.5, 1) ( value) q, metric, query
from ( select * from unstable_run_metrics
union all select * from unstable_run_traces
2020-02-27 17:57:08 +00:00
union all select * from unstable_run_metrics_2) mm
2020-02-17 19:32:40 +00:00
join queries using query
group by query, metric
having d > 0.5
order by any( rd[ 3] ) desc, d desc
;
2020-02-20 16:28:21 +00:00
create table stacks engine File( TSV, 'stacks.rep' ) as
select
query,
arrayStringConcat(
arrayMap( x -> joinGet( right_addresses_join, 'name' , x) ,
arrayReverse( trace)
) ,
';'
) readable_trace,
count( )
from right_trace_log
join unstable_query_runs using query_id
group by query, trace
;
2020-02-07 18:34:24 +00:00
"
2020-02-11 15:01:16 +00:00
2020-02-20 16:28:21 +00:00
IFS = $'\n'
2020-02-21 19:58:52 +00:00
for query in $( cut -d' ' -f1 stacks.rep | sort | uniq)
2020-02-20 16:28:21 +00:00
do
2020-02-27 20:02:50 +00:00
query_file = $( echo " $query " | cut -c-120 | sed 's/[/]/_/g' )
2020-02-28 16:22:07 +00:00
grep -F " $query " stacks.rep \
2020-02-21 19:58:52 +00:00
| cut -d' ' -f 2- \
| tee " $query_file .stacks.rep " \
| ~/fg/flamegraph.pl > " $query_file .svg " &
2020-02-20 16:28:21 +00:00
done
wait
unset IFS
2020-02-11 15:01:16 +00:00
# Remember that grep sets error code when nothing is found, hence the bayan
2020-03-02 18:47:37 +00:00
# operator.
grep -H -m2 'Exception:[^:]' ./*-err.log | sed 's/:/\t/' > run-errors.tsv || :
2020-01-23 17:48:26 +00:00
2020-02-27 20:02:50 +00:00
" $script_dir /report.py " > report.html
2020-02-07 18:34:24 +00:00
}
2020-02-10 18:37:46 +00:00
case " $stage " in
"" )
; &
"download" )
2020-02-14 19:11:46 +00:00
time download
; &
"configure" )
time configure
; &
"restart" )
time restart
; &
"run_tests" )
2020-02-28 16:22:07 +00:00
# Ignore the errors to collect the log anyway
2020-02-25 19:51:09 +00:00
time run_tests || :
2020-02-14 19:11:46 +00:00
; &
"get_profiles" )
2020-02-28 16:22:07 +00:00
# If the tests fail with OOM or something, still try to restart the servers
# to collect the logs. Prefer not to restart, because addresses might change
# and we won't be able to process trace_log data.
time get_profiles || restart || get_profiles
2020-03-03 10:47:32 +00:00
# Stop the servers to free memory for the subsequent query analysis.
while killall clickhouse; do echo . ; sleep 1 ; done
echo Servers stopped.
2020-02-10 18:37:46 +00:00
; &
2020-02-27 19:43:43 +00:00
"analyze_queries" )
2020-02-28 16:22:07 +00:00
time analyze_queries
2020-02-27 19:43:43 +00:00
; &
2020-02-10 18:37:46 +00:00
"report" )
2020-02-14 19:11:46 +00:00
time report
2020-02-10 18:37:46 +00:00
; &
esac