Fix 01045 test

This commit is contained in:
alesapin 2020-03-20 14:22:25 +03:00
parent c41c527bdf
commit dcb505b993

View File

@ -5,6 +5,17 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/mergetree_mutations.lib . $CURDIR/mergetree_mutations.lib
function wait_mutation_to_start()
{
query_wait=`$CLICKHOUSE_CLIENT --query="SELECT length(parts_to_do_names) FROM system.mutations where table = 'replicated_table_for_mutations'" 2>&1`
while [ "$query_wait" == "0" ] || [ -z "$query_wait" ]
do
query_wait=`$CLICKHOUSE_CLIENT --query="SELECT length(parts_to_do_names) FROM system.mutations where table = '$1'" 2>&1`
sleep 0.5
done
}
${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS table_for_mutations" ${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS table_for_mutations"
${CLICKHOUSE_CLIENT} --query="CREATE TABLE table_for_mutations(k UInt32, v1 UInt64) ENGINE MergeTree ORDER BY k PARTITION BY modulo(k, 2)" ${CLICKHOUSE_CLIENT} --query="CREATE TABLE table_for_mutations(k UInt32, v1 UInt64) ENGINE MergeTree ORDER BY k PARTITION BY modulo(k, 2)"
@ -19,6 +30,8 @@ ${CLICKHOUSE_CLIENT} --query="ALTER TABLE table_for_mutations UPDATE v1 = v1 + 1
${CLICKHOUSE_CLIENT} --query="SELECT is_done, parts_to_do_names, parts_to_do FROM system.mutations where table = 'table_for_mutations'" ${CLICKHOUSE_CLIENT} --query="SELECT is_done, parts_to_do_names, parts_to_do FROM system.mutations where table = 'table_for_mutations'"
wait_mutation_to_start "table_for_mutations"
${CLICKHOUSE_CLIENT} --query="SYSTEM START MERGES" ${CLICKHOUSE_CLIENT} --query="SYSTEM START MERGES"
wait_for_mutation "table_for_mutations" "mutation_3.txt" wait_for_mutation "table_for_mutations" "mutation_3.txt"
@ -42,6 +55,8 @@ ${CLICKHOUSE_CLIENT} --query="SELECT sum(v1) FROM replicated_table_for_mutations
${CLICKHOUSE_CLIENT} --query="ALTER TABLE replicated_table_for_mutations UPDATE v1 = v1 + 1 WHERE 1" ${CLICKHOUSE_CLIENT} --query="ALTER TABLE replicated_table_for_mutations UPDATE v1 = v1 + 1 WHERE 1"
wait_mutation_to_start "replicated_table_for_mutations"
${CLICKHOUSE_CLIENT} --query="SELECT is_done, parts_to_do_names, parts_to_do FROM system.mutations where table = 'replicated_table_for_mutations'" ${CLICKHOUSE_CLIENT} --query="SELECT is_done, parts_to_do_names, parts_to_do FROM system.mutations where table = 'replicated_table_for_mutations'"
${CLICKHOUSE_CLIENT} --query="SYSTEM START MERGES" ${CLICKHOUSE_CLIENT} --query="SYSTEM START MERGES"