mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-12 10:34:21 +00:00
Fix flaky test
This commit is contained in:
parent
084554aac4
commit
909a50e648
@ -353,6 +353,9 @@ Chunk DDLQueryStatusSource::generate()
|
||||
|
||||
IProcessor::Status DDLQueryStatusSource::prepare()
|
||||
{
|
||||
/// This method is overloaded to throw exception after all data is read.
|
||||
/// Exception is pushed into pipe (instead of simply being thrown) to ensure the order of data processing and exception.
|
||||
|
||||
if (finished)
|
||||
{
|
||||
bool throw_if_error_on_host = context->getSettingsRef().distributed_ddl_output_mode != DistributedDDLOutputMode::NEVER_THROW;
|
||||
|
@ -7,6 +7,25 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
|
||||
# We execute a distributed DDL query with timeout 1 to check that one host is unavailable and will time out and other complete successfully.
|
||||
# But sometimes one second is not enough even for healthy host to succeed. Repeat the test in this case.
|
||||
function run_until_out_contains()
|
||||
{
|
||||
PATTERN=$1
|
||||
shift
|
||||
|
||||
while true
|
||||
do
|
||||
"$@" > "${CLICKHOUSE_TMP}/out" 2>&1
|
||||
if grep -q "$PATTERN" "${CLICKHOUSE_TMP}/out"
|
||||
then
|
||||
cat "${CLICKHOUSE_TMP}/out"
|
||||
break;
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
$CLICKHOUSE_CLIENT -q "drop table if exists none;"
|
||||
$CLICKHOUSE_CLIENT -q "drop table if exists throw;"
|
||||
$CLICKHOUSE_CLIENT -q "drop table if exists null_status;"
|
||||
@ -18,22 +37,22 @@ $CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=600 --distributed_ddl_output_m
|
||||
# Table exists
|
||||
$CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=600 --distributed_ddl_output_mode=none -q "create table none on cluster test_shard_localhost (n int) engine=Memory;" 2>&1 | sed "s/DB::Exception/Error/g" | sed "s/ (version.*)//"
|
||||
# Timeout
|
||||
$CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=1 --distributed_ddl_output_mode=none -q "drop table none on cluster test_unavailable_shard;" 2>&1 | sed "s/DB::Exception/Error/g" | sed "s/ (version.*)//" | sed "s/Watching task .* is executing longer/Watching task <task> is executing longer/"
|
||||
run_until_out_contains 'There are 1 unfinished hosts' $CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=1 --distributed_ddl_output_mode=none -q "drop table none on cluster test_unavailable_shard;" 2>&1 | sed "s/DB::Exception/Error/g" | sed "s/ (version.*)//" | sed "s/Watching task .* is executing longer/Watching task <task> is executing longer/"
|
||||
|
||||
$CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=600 --distributed_ddl_output_mode=throw -q "select value from system.settings where name='distributed_ddl_output_mode';"
|
||||
$CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=600 --distributed_ddl_output_mode=throw -q "create table throw on cluster test_shard_localhost (n int) engine=Memory;"
|
||||
$CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=600 --distributed_ddl_output_mode=throw -q "create table throw on cluster test_shard_localhost (n int) engine=Memory format Null;" 2>&1 | sed "s/DB::Exception/Error/g" | sed "s/ (version.*)//"
|
||||
$CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=1 --distributed_ddl_output_mode=throw -q "drop table throw on cluster test_unavailable_shard;" 2>&1 | sed "s/DB::Exception/Error/g" | sed "s/ (version.*)//" | sed "s/Watching task .* is executing longer/Watching task <task> is executing longer/"
|
||||
run_until_out_contains 'There are 1 unfinished hosts' $CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=1 --distributed_ddl_output_mode=throw -q "drop table throw on cluster test_unavailable_shard;" 2>&1 | sed "s/DB::Exception/Error/g" | sed "s/ (version.*)//" | sed "s/Watching task .* is executing longer/Watching task <task> is executing longer/"
|
||||
|
||||
$CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=600 --distributed_ddl_output_mode=null_status_on_timeout -q "select value from system.settings where name='distributed_ddl_output_mode';"
|
||||
$CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=600 --distributed_ddl_output_mode=null_status_on_timeout -q "create table null_status on cluster test_shard_localhost (n int) engine=Memory;"
|
||||
$CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=600 --distributed_ddl_output_mode=null_status_on_timeout -q "create table null_status on cluster test_shard_localhost (n int) engine=Memory format Null;" 2>&1 | sed "s/DB::Exception/Error/g" | sed "s/ (version.*)//"
|
||||
$CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=1 --distributed_ddl_output_mode=null_status_on_timeout -q "drop table null_status on cluster test_unavailable_shard;"
|
||||
run_until_out_contains '9000 0 ' $CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=1 --distributed_ddl_output_mode=null_status_on_timeout -q "drop table null_status on cluster test_unavailable_shard;"
|
||||
|
||||
$CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=600 --distributed_ddl_output_mode=never_throw -q "select value from system.settings where name='distributed_ddl_output_mode';"
|
||||
$CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=600 --distributed_ddl_output_mode=never_throw -q "create table never_throw on cluster test_shard_localhost (n int) engine=Memory;"
|
||||
$CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=600 --distributed_ddl_output_mode=never_throw -q "create table never_throw on cluster test_shard_localhost (n int) engine=Memory;" 2>&1 | sed "s/DB::Exception/Error/g" | sed "s/ (version.*)//"
|
||||
$CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=1 --distributed_ddl_output_mode=never_throw -q "drop table never_throw on cluster test_unavailable_shard;"
|
||||
run_until_out_contains '9000 0 ' $CLICKHOUSE_CLIENT --distributed_ddl_task_timeout=1 --distributed_ddl_output_mode=never_throw -q "drop table never_throw on cluster test_unavailable_shard;"
|
||||
|
||||
$CLICKHOUSE_CLIENT -q "drop table if exists none;"
|
||||
$CLICKHOUSE_CLIENT -q "drop table if exists throw;"
|
||||
|
Loading…
Reference in New Issue
Block a user