mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
Add test for race condition
This commit is contained in:
parent
ea17d033ec
commit
5177309001
@ -0,0 +1 @@
|
||||
1
|
32
dbms/tests/queries/0_stateless/00980_alter_settings_race.sh
Executable file
32
dbms/tests/queries/0_stateless/00980_alter_settings_race.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
. $CURDIR/../shell_config.sh
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS table_for_concurrent_alter"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="CREATE TABLE table_for_concurrent_alter (id UInt64, Data String) ENGINE = MergeTree() ORDER BY id SETTINGS index_granularity=4096;";
|
||||
|
||||
n=0
|
||||
while [ "$n" -lt 100 ];
|
||||
do
|
||||
n=$(( n + 1 ))
|
||||
$CLICKHOUSE_CLIENT --query="INSERT INTO table_for_concurrent_alter VALUES(1, 'Hello')" > /dev/null 2> /dev/null &
|
||||
$CLICKHOUSE_CLIENT --query="OPTIMIZE TABLE table_for_concurrent_alter FINAL" > /dev/null 2> /dev/null &
|
||||
done &
|
||||
|
||||
|
||||
q=0
|
||||
while [ "$q" -lt 100 ];
|
||||
do
|
||||
q=$(( q + 1 ))
|
||||
counter=$(( 100 + q ))
|
||||
$CLICKHOUSE_CLIENT --query="ALTER TABLE table_for_concurrent_alter MODIFY SETTING parts_to_throw_insert = $counter, parts_to_delay_insert = $counter, min_merge_bytes_to_use_direct_io = $counter" > /dev/null 2> /dev/null &
|
||||
done &
|
||||
|
||||
sleep 4
|
||||
|
||||
# we just test race conditions, not logic
|
||||
$CLICKHOUSE_CLIENT --query "SELECT 1"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS table_for_concurrent_alter"
|
@ -35,7 +35,7 @@ INSERT INTO table_for_alter VALUES (2, '2'); -- { serverError 252 }
|
||||
|
||||
ALTER TABLE table_for_alter MODIFY SETTING xxx_yyy=124; -- { serverError 115 }
|
||||
|
||||
ALTER TABLE table_for_alter MODIFY SETTING parts_to_throw_insert = 100, parts_to_delay_insert = 100;
|
||||
ALTER TABLE table_for_alter MODIFY SETTING parts_to_throw_insert = 100, parts_to_delay_insert = 100;
|
||||
|
||||
INSERT INTO table_for_alter VALUES (2, '2');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user