Merge pull request #18897 from azat/stress-tests-no-restart-replicas

Drop RESTART REPLICAS from stateless tests to avoid locking lots of mutexes
This commit is contained in:
alexey-milovidov 2021-01-11 18:53:01 +03:00 committed by GitHub
commit f8473222c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 14 deletions

View File

@ -467,8 +467,11 @@ void InterpreterSystemQuery::restartReplicas(Context & system_context)
guard.second = catalog.getDDLGuard(guard.first.database_name, guard.first.table_name);
ThreadPool pool(std::min(size_t(getNumberOfPhysicalCPUCores()), replica_names.size()));
for (auto & table : replica_names)
pool.scheduleOrThrowOnError([&]() { tryRestartReplica(table, system_context, false); });
for (auto & replica : replica_names)
{
LOG_TRACE(log, "Restarting replica on {}", replica.getNameForLogs());
pool.scheduleOrThrowOnError([&]() { tryRestartReplica(replica, system_context, false); });
}
pool.wait();
}

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

@ -33,20 +33,24 @@ function rename_thread_2()
done
}
function restart_thread_1()
function restart_replicas_loop()
{
while true; do
$CLICKHOUSE_CLIENT -q "SYSTEM RESTART REPLICAS";
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;

View File

@ -0,0 +1,2 @@
x Date
s String

View File

@ -0,0 +1,5 @@
DROP TABLE IF EXISTS data_01646;
CREATE TABLE data_01646 (x Date, s String) ENGINE = ReplicatedMergeTree('/clickhouse/tables/test_01646/data_01646', 'r') ORDER BY s PARTITION BY x;
SYSTEM RESTART REPLICAS;
DESCRIBE TABLE data_01646;
DROP TABLE data_01646;

View File

@ -15,7 +15,8 @@
"01526_max_untracked_memory", /// requires TraceCollector, does not available under sanitizers
"01474_executable_dictionary", /// informational stderr from sanitizer at start
"functions_bad_arguments", /// Too long for TSan
"01603_read_with_backoff_bug" /// Too long for TSan
"01603_read_with_backoff_bug", /// Too long for TSan
"01646_system_restart_replicas_smoke" /// RESTART REPLICAS can acquire too much locks, while only 64 is possible from one thread under TSan
],
"address-sanitizer": [
"00877",