mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 09:22:05 +00:00
Less global queries in functional tests
This commit is contained in:
parent
c9b382b4af
commit
eb9b3e6737
@ -7,11 +7,11 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|||||||
|
|
||||||
function wait_mutation_to_start()
|
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" ]
|
while [ "$query_wait" == "0" ] || [ -z "$query_wait" ]
|
||||||
do
|
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
|
sleep 0.5
|
||||||
done
|
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="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)"
|
${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"
|
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"
|
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="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)"
|
${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="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"
|
wait_for_mutation "replicated_table_for_mutations" "0000000000"
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
DROP TABLE IF EXISTS mt;
|
DROP TABLE IF EXISTS mt;
|
||||||
|
|
||||||
CREATE TABLE mt (v UInt8) ENGINE = MergeTree() order by tuple();
|
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 (0);
|
||||||
INSERT INTO mt VALUES (1);
|
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 v FROM mt ORDER BY v;
|
||||||
|
|
||||||
SELECT '-- resume merges --';
|
SELECT '-- resume merges --';
|
||||||
SYSTEM START MERGES;
|
SYSTEM START MERGES mt;
|
||||||
OPTIMIZE TABLE mt FINAL;
|
OPTIMIZE TABLE mt FINAL;
|
||||||
|
|
||||||
SELECT v FROM mt ORDER BY v;
|
SELECT v FROM mt ORDER BY v;
|
||||||
|
Loading…
Reference in New Issue
Block a user