Less global queries in functional tests

This commit is contained in:
alesapin 2020-11-23 17:57:46 +03:00
parent c9b382b4af
commit eb9b3e6737
2 changed files with 8 additions and 8 deletions

View File

@ -7,11 +7,11 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
function wait_mutation_to_start()
{
query_wait=$($CLICKHOUSE_CLIENT --query="SELECT length(parts_to_do_names) FROM system.mutations where table = '$1'" 2>&1)
query_wait=$($CLICKHOUSE_CLIENT --query="SELECT length(parts_to_do_names) FROM system.mutations where table = '$1' and database='${CLICKHOUSE_DATABASE}'" 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)
query_wait=$($CLICKHOUSE_CLIENT --query="SELECT length(parts_to_do_names) FROM system.mutations where table = '$1' and database='${CLICKHOUSE_DATABASE}'" 2>&1)
sleep 0.5
done
}
@ -20,7 +20,7 @@ ${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="SYSTEM STOP MERGES"
${CLICKHOUSE_CLIENT} --query="SYSTEM STOP MERGES table_for_mutations"
${CLICKHOUSE_CLIENT} --query="INSERT INTO table_for_mutations select number, number from numbers(100000)"
@ -32,7 +32,7 @@ ${CLICKHOUSE_CLIENT} --query="SELECT is_done, parts_to_do_names, parts_to_do FRO
wait_mutation_to_start "table_for_mutations"
${CLICKHOUSE_CLIENT} --query="SYSTEM START MERGES"
${CLICKHOUSE_CLIENT} --query="SYSTEM START MERGES table_for_mutations"
wait_for_mutation "table_for_mutations" "mutation_3.txt"
@ -47,7 +47,7 @@ ${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS replicated_table_for_mutation
${CLICKHOUSE_CLIENT} --query="CREATE TABLE replicated_table_for_mutations(k UInt32, v1 UInt64) ENGINE ReplicatedMergeTree('/clickhouse/tables/test_01045/replicated_table_for_mutations', '1') ORDER BY k PARTITION BY modulo(k, 2)"
${CLICKHOUSE_CLIENT} --query="SYSTEM STOP MERGES"
${CLICKHOUSE_CLIENT} --query="SYSTEM STOP MERGES replicated_table_for_mutations"
${CLICKHOUSE_CLIENT} --query="INSERT INTO replicated_table_for_mutations select number, number from numbers(100000)"
@ -59,7 +59,7 @@ 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="SYSTEM START MERGES"
${CLICKHOUSE_CLIENT} --query="SYSTEM START MERGES replicated_table_for_mutations"
wait_for_mutation "replicated_table_for_mutations" "0000000000"

View File

@ -1,7 +1,7 @@
DROP TABLE IF EXISTS mt;
CREATE TABLE mt (v UInt8) ENGINE = MergeTree() order by tuple();
SYSTEM STOP MERGES;
SYSTEM STOP MERGES mt;
INSERT INTO mt VALUES (0);
INSERT INTO mt VALUES (1);
@ -32,7 +32,7 @@ ALTER TABLE mt ATTACH PART 'all_4_4_0'; -- { serverError 233 }
SELECT v FROM mt ORDER BY v;
SELECT '-- resume merges --';
SYSTEM START MERGES;
SYSTEM START MERGES mt;
OPTIMIZE TABLE mt FINAL;
SELECT v FROM mt ORDER BY v;