Add settings to storage in test

This commit is contained in:
alesapin 2020-02-20 11:50:00 +03:00
parent e69fd2ac0d
commit 2561e27ead

View File

@ -4,7 +4,7 @@
# This test checks mutations concurrent execution with concurrent inserts. # This test checks mutations concurrent execution with concurrent inserts.
# There was a bug in mutations finalization, when mutation finishes not after all # There was a bug in mutations finalization, when mutation finishes not after all
# MUTATE_PART tasks execution, but after GET of already mutated part from other replica. # MUTATE_PART tasks execution, but after GET of already mutated part from other replica.
# To test it we stop replicated sends on some replicas to delay fetch of required parts for mutation. # To test it we stop some replicas to delay fetch of required parts for mutation.
# Since our replication queue executing tasks concurrently it may happen, that we dowload already mutated # Since our replication queue executing tasks concurrently it may happen, that we dowload already mutated
# part before source part. # part before source part.
@ -19,7 +19,7 @@ for i in `seq $REPLICAS`; do
done done
for i in `seq $REPLICAS`; do for i in `seq $REPLICAS`; do
$CLICKHOUSE_CLIENT --query "CREATE TABLE concurrent_mutate_mt_$i (key UInt64, value1 UInt64, value2 String) ENGINE = ReplicatedMergeTree('/clickhouse/tables/concurrent_mutate_mt', '$i') ORDER BY key" $CLICKHOUSE_CLIENT --query "CREATE TABLE concurrent_mutate_mt_$i (key UInt64, value1 UInt64, value2 String) ENGINE = ReplicatedMergeTree('/clickhouse/tables/concurrent_mutate_mt', '$i') ORDER BY key SETTINGS max_replicated_mutations_in_queue=1000, number_of_free_entries_in_pool_to_execute_mutation=0,max_replicated_merges_in_queue=1000"
done done
$CLICKHOUSE_CLIENT --query "INSERT INTO concurrent_mutate_mt_1 SELECT number, number + 10, toString(number) from numbers(10)" $CLICKHOUSE_CLIENT --query "INSERT INTO concurrent_mutate_mt_1 SELECT number, number + 10, toString(number) from numbers(10)"
@ -38,10 +38,8 @@ INITIAL_SUM=`$CLICKHOUSE_CLIENT --query "SELECT SUM(value1) FROM concurrent_muta
# Run mutation on random replica # Run mutation on random replica
function correct_alter_thread() function correct_alter_thread()
{ {
TYPES=(Float64 String UInt8 UInt32)
while true; do while true; do
REPLICA=$(($RANDOM % 5 + 1)) REPLICA=$(($RANDOM % 5 + 1))
TYPE=${TYPES[$RANDOM % ${#TYPES[@]} ]}
$CLICKHOUSE_CLIENT --query "ALTER TABLE concurrent_mutate_mt_$REPLICA UPDATE value1 = value1 + 1 WHERE 1"; $CLICKHOUSE_CLIENT --query "ALTER TABLE concurrent_mutate_mt_$REPLICA UPDATE value1 = value1 + 1 WHERE 1";
sleep 0.$RANDOM sleep 0.$RANDOM
done done
@ -66,6 +64,8 @@ function detach_attach_thread()
REPLICA=$(($RANDOM % 5 + 1)) REPLICA=$(($RANDOM % 5 + 1))
$CLICKHOUSE_CLIENT --query "DETACH TABLE concurrent_mutate_mt_$REPLICA" $CLICKHOUSE_CLIENT --query "DETACH TABLE concurrent_mutate_mt_$REPLICA"
sleep 0.$RANDOM sleep 0.$RANDOM
sleep 0.$RANDOM
sleep 0.$RANDOM
$CLICKHOUSE_CLIENT --query "ATTACH TABLE concurrent_mutate_mt_$REPLICA" $CLICKHOUSE_CLIENT --query "ATTACH TABLE concurrent_mutate_mt_$REPLICA"
done done
} }
@ -77,7 +77,8 @@ export -f correct_alter_thread;
export -f insert_thread; export -f insert_thread;
export -f detach_attach_thread; export -f detach_attach_thread;
TIMEOUT=30 # We assign a lot of mutations so timeout shouldn't be too big
TIMEOUT=15
timeout $TIMEOUT bash -c detach_attach_thread 2> /dev/null & timeout $TIMEOUT bash -c detach_attach_thread 2> /dev/null &
@ -101,8 +102,15 @@ done
sleep 1 sleep 1
counter=0
while [[ $($CLICKHOUSE_CLIENT --query "select * from system.mutations where table like 'concurrent_mutate_mt_%' and is_done=0" 2>&1) ]]; do while [[ $($CLICKHOUSE_CLIENT --query "select * from system.mutations where table like 'concurrent_mutate_mt_%' and is_done=0" 2>&1) ]]; do
if [ "$counter" -gt 20 ]
then
break
fi
sleep 1 sleep 1
counter=$(($counter + 1))
done done
for i in `seq $REPLICAS`; do for i in `seq $REPLICAS`; do