Skip to content

Commit 74ce3a9

Browse files
Merge pull request ClickHouse#80383 from ClickHouse/fix-test-02479_race_condition_between_insert_and_droppin_mv
Fix test `02479_race_condition_between_insert_and_droppin_mv.sh`
2 parents f62a2ac + 6f10880 commit 74ce3a9

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tests/queries/0_stateless/02479_race_condition_between_insert_and_droppin_mv.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
99
# shellcheck source=../shell_config.sh
1010
. "$CURDIR"/../shell_config.sh
1111

12+
TIMEOUT=50
13+
1214
function insert {
1315
i=0
1416
offset=500
15-
while true;
17+
local TIMELIMIT=$((SECONDS+TIMEOUT))
18+
while [ $SECONDS -lt "$TIMELIMIT" ]
1619
do
1720
${CLICKHOUSE_CLIENT} -q "INSERT INTO test_race_condition_landing SELECT number, toString(number), toString(number) from system.numbers limit $i, $offset settings ignore_materialized_views_with_dropped_target_table=1"
1821
i=$(( $i + $RANDOM % 100 + 400 ))
@@ -21,7 +24,8 @@ function insert {
2124

2225
function drop_mv {
2326
index=$1
24-
while true;
27+
local TIMELIMIT=$((SECONDS+TIMEOUT))
28+
while [ $SECONDS -lt "$TIMELIMIT" ]
2529
do
2630
${CLICKHOUSE_CLIENT} -q "DROP TABLE IF EXISTS test_race_condition_mv_$index"
2731
${CLICKHOUSE_CLIENT} -q "CREATE MATERIALIZED VIEW IF NOT EXISTS test_race_condition_mv1_$index TO test_race_condition_target AS select count() as number FROM (SELECT a.number, a.n, a.n2, b.number, b.n, b.n2, c.number, c.n, c.n2 FROM test_race_condition_landing a CROSS JOIN test_race_condition_landing b CROSS JOIN test_race_condition_landing c)"
@@ -38,16 +42,14 @@ ${CLICKHOUSE_CLIENT} -q "CREATE TABLE test_race_condition_landing (number Int64,
3842
export -f drop_mv;
3943
export -f insert;
4044

41-
TIMEOUT=50
42-
4345
for i in {1..4}
4446
do
45-
timeout $TIMEOUT bash -c "drop_mv $i" &
47+
drop_mv $i &
4648
done
4749

4850
for i in {1..4}
4951
do
50-
timeout $TIMEOUT bash -c "insert 20" &
52+
insert 20 &
5153
done
5254

5355
wait

0 commit comments

Comments
 (0)