Avoid timeouts in perf test

This commit is contained in:
Alexander Kuzmenkov 2020-08-19 18:08:23 +03:00
parent ecc40b7c75
commit 000326b627
2 changed files with 39 additions and 4 deletions

View File

@ -7,6 +7,29 @@ trap 'kill $(jobs -pr) ||:' EXIT
stage=${stage:-}
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
function wait_for_server # port, pid
{
for _ in {1..60}
do
if clickhouse-client --port "$1" --query "select 1" || ! kill -0 "$2"
then
break
fi
sleep 1
done
if ! clickhouse-client --port "$1" --query "select 1"
then
echo "Cannot connect to ClickHouse server at $1"
return 1
fi
if ! kill -0 "$2"
then
echo "Server pid '$2' is not running"
return 1
fi
}
function configure
{
@ -27,8 +50,9 @@ function configure
kill -0 $left_pid
disown $left_pid
set +m
while ! clickhouse-client --port 9001 --query "select 1" && kill -0 $left_pid ; do echo . ; sleep 1 ; done
echo server for setup started
wait_for_server 9001 $left_pid
echo Server for setup started
clickhouse-client --port 9001 --query "create database test" ||:
clickhouse-client --port 9001 --query "rename table datasets.hits_v1 to test.hits" ||:
@ -67,9 +91,10 @@ function restart
set +m
while ! clickhouse-client --port 9001 --query "select 1" && kill -0 $left_pid ; do echo . ; sleep 1 ; done
wait_for_server 9001 $left_pid
echo left ok
while ! clickhouse-client --port 9002 --query "select 1" && kill -0 $right_pid ; do echo . ; sleep 1 ; done
wait_for_server 9002 $right_pid
echo right ok
clickhouse-client --port 9001 --query "select * from system.tables where database != 'system'"

View File

@ -6,6 +6,16 @@
<allow_introspection_functions>1</allow_introspection_functions>
<log_queries>1</log_queries>
<metrics_perf_events_enabled>1</metrics_perf_events_enabled>
<!--
If a test takes too long by mistake, the entire test task can
time out and the author won't get a proper message. Put some cap
on query execution time to prevent this. Test query run time is
limited to about 2 seconds, but this limit applies to all queries,
including fill/create and maintenance such as downloading trace
logs, so it must be generous enough. As a second line of defense,
we might also add time check to perf.py script.
-->
<max_execution_time>300</max_execution_time>
</default>
</profiles>
</yandex>