From 0c6838a04377f6373aa341414e46c6559be953ac Mon Sep 17 00:00:00 2001 From: alesapin Date: Mon, 21 Dec 2020 11:48:40 +0300 Subject: [PATCH] Fix glaky 01076_parallel_alter test --- .../01076_parallel_alter_replicated_zookeeper.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/queries/0_stateless/01076_parallel_alter_replicated_zookeeper.sh b/tests/queries/0_stateless/01076_parallel_alter_replicated_zookeeper.sh index 4f86d7c1666..c9e5d7b9447 100755 --- a/tests/queries/0_stateless/01076_parallel_alter_replicated_zookeeper.sh +++ b/tests/queries/0_stateless/01076_parallel_alter_replicated_zookeeper.sh @@ -103,8 +103,10 @@ done sleep 1 counter=0 +have_undone_mutations_query="select * from system.mutations where table like 'concurrent_mutate_mt_%' and is_done=0 and database='${CLICKHOUSE_DATABASE}'" +have_all_tables_query="select count() FROM system.tables WHERE name LIKE 'concurrent_mutate_mt_%' and database='${CLICKHOUSE_DATABASE}'" -while [[ $($CLICKHOUSE_CLIENT --query "select * from system.mutations where table like 'concurrent_mutate_mt_%' and is_done=0" 2>&1) ]]; do +while true ; do if [ "$counter" -gt 120 ] then break @@ -113,7 +115,13 @@ while [[ $($CLICKHOUSE_CLIENT --query "select * from system.mutations where tabl for i in $(seq $REPLICAS); do $CLICKHOUSE_CLIENT --query "ATTACH TABLE concurrent_mutate_mt_$i" 2> /dev/null done + counter=$(($counter + 1)) + + # no active mutations and all tables attached + if [[ -z $($CLICKHOUSE_CLIENT --query "$have_undone_mutations_query" 2>&1) && $($CLICKHOUSE_CLIENT --query "$have_all_tables_query" 2>&1) == "$REPLICAS" ]]; then + break + fi done for i in $(seq $REPLICAS); do