This commit is contained in:
alesapin 2020-05-14 15:45:42 +03:00
parent a808af85b5
commit e5c8c8ca02
2 changed files with 19 additions and 17 deletions

View File

@ -1 +1,2 @@
1
inconsistencies 0 inconsistencies 0

View File

@ -31,12 +31,18 @@ function insert_thread() {
INSERT[1]="INSERT INTO TABLE src_b VALUES (2);" INSERT[1]="INSERT INTO TABLE src_b VALUES (2);"
while true; do while true; do
# trigger 100 concurrent inserts at a time # trigger 50 concurrent inserts at a time
for i in {0..100}; do for i in {0..50}; do
# ignore `Possible deadlock avoided. Client should retry` # ignore `Possible deadlock avoided. Client should retry`
$CLICKHOUSE_CLIENT -q "${INSERT[$RANDOM % 2]}" 2>/dev/null & $CLICKHOUSE_CLIENT -q "${INSERT[$RANDOM % 2]}" 2>/dev/null &
done done
wait wait
is_done=$($CLICKHOUSE_CLIENT -q "SELECT countIf(case = 1) > 0 AND countIf(case = 2) > 0 FROM mv;")
if [ "$is_done" -eq "1" ]; then
break
fi
done done
} }
@ -50,28 +56,23 @@ function alter_thread() {
$CLICKHOUSE_CLIENT --allow_experimental_alter_materialized_view_structure=1 \ $CLICKHOUSE_CLIENT --allow_experimental_alter_materialized_view_structure=1 \
-q "${ALTER[$RANDOM % 2]}" -q "${ALTER[$RANDOM % 2]}"
sleep "0.0$RANDOM" sleep "0.0$RANDOM"
is_done=$($CLICKHOUSE_CLIENT -q "SELECT countIf(case = 1) > 0 AND countIf(case = 2) > 0 FROM mv;")
if [ "$is_done" -eq "1" ]; then
break
fi
done done
} }
export -f insert_thread; export -f insert_thread;
export -f alter_thread; export -f alter_thread;
timeout 30 bash -c insert_thread & # finishes much faster with all builds, except debug with coverage
timeout 30 bash -c alter_thread & timeout 120 bash -c insert_thread &
timeout 120 bash -c alter_thread &
function check_thread() {
while true; do
is_done=$($CLICKHOUSE_CLIENT -q "SELECT countIf(case = 1) > 0 AND countIf(case = 2) > 0 FROM mv;")
if [ "$is_done" -eq "1" ]; then
break
fi
done
}
export -f check_thread
timeout 30 bash -c check_thread
wait wait
$CLICKHOUSE_CLIENT -q "SELECT countIf(case = 1) > 0 AND countIf(case = 2) > 0 FROM mv LIMIT 1;"
$CLICKHOUSE_CLIENT -q "SELECT 'inconsistencies', count() FROM mv WHERE test == 0;" $CLICKHOUSE_CLIENT -q "SELECT 'inconsistencies', count() FROM mv WHERE test == 0;"