Drop RESTART REPLICAS from stateless tests to avoid locking lots of mutexes

Under TSan you can lock only not more then 64 mutexes from one thread at
once [1] [2], while RESTART REPLICAS can acquire more (it depends on the
number of replicated tables).

  [1]: https://github.com/google/sanitizers/issues/950#issuecomment-386711603
  [2]: b02eab9058/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h (L67)

And since stress tests run tests in parallel, you can have more then 64
ReplicatedMergeTree tables at once (even though it is unlikely).

Fix this by using RESTART REPLICA table over RESTART REPLICAS.
This commit is contained in:
Azat Khuzhin 2021-01-10 12:14:26 +03:00
parent fe1c153c6f
commit 30741232d2
3 changed files with 17 additions and 11 deletions

View File

@ -151,7 +151,7 @@ $CLICKHOUSE_CLIENT --query="SELECT count(), sum(d), uniqExact(_part) FROM dst_r2
$CLICKHOUSE_CLIENT --query="SELECT 'After restart';"
$CLICKHOUSE_CLIENT --query="SYSTEM RESTART REPLICA dst_r1;"
$CLICKHOUSE_CLIENT --query="SYSTEM RESTART REPLICAS;"
$CLICKHOUSE_CLIENT --query="SYSTEM RESTART REPLICA dst_r2;"
$CLICKHOUSE_CLIENT --query="SELECT count(), sum(d) FROM dst_r1;"
$CLICKHOUSE_CLIENT --query="SELECT count(), sum(d) FROM dst_r2;"

View File

@ -19,7 +19,7 @@ function rename_thread_1()
replica_01108_3 TO replica_01108_3_tmp,
replica_01108_4 TO replica_01108_4_tmp";
sleep 0.$RANDOM;
done
done
}
function rename_thread_2()
@ -30,23 +30,27 @@ function rename_thread_2()
replica_01108_3_tmp TO replica_01108_4,
replica_01108_4_tmp TO replica_01108_1";
sleep 0.$RANDOM;
done
done
}
function restart_thread_1()
function restart_replicas_loop()
{
while true; do
$CLICKHOUSE_CLIENT -q "SYSTEM RESTART REPLICAS";
sleep 0.$RANDOM;
for i in $(seq 4); do
$CLICKHOUSE_CLIENT -q "SYSTEM RESTART REPLICA replica_01108_${i}";
$CLICKHOUSE_CLIENT -q "SYSTEM RESTART REPLICA replica_01108_${i}_tmp";
done
sleep 0.$RANDOM;
done
}
function restart_thread_1()
{
restart_replicas_loop
}
function restart_thread_2()
{
while true; do
$CLICKHOUSE_CLIENT -q "SYSTEM RESTART REPLICAS";
sleep 0.$RANDOM;
done
restart_replicas_loop
}
export -f rename_thread_1;

View File

@ -17,7 +17,9 @@ ALTER TABLE test_alter_r2 MODIFY COLUMN x DEFAULT '2000-01-01' SETTINGS replicat
DESCRIBE TABLE test_alter_r1;
DESCRIBE TABLE test_alter_r2;
SYSTEM RESTART REPLICAS;
SYSTEM RESTART REPLICA test_alter_r1;
SYSTEM RESTART REPLICA test_alter_r2;
DESCRIBE TABLE test_alter_r1;
DESCRIBE TABLE test_alter_r2;