Revert "Merge pull request #35865 from azat/clickhouse-test-left-queries"

This reverts commit 18d094d79d, reversing
changes made to 224f4dc620.
This commit is contained in:
Alexander Tokmakov 2022-05-28 19:23:58 +02:00
parent e33d986cf1
commit 1ae919a18a
9 changed files with 55 additions and 87 deletions

View File

@ -92,8 +92,6 @@ function run_tests()
if [[ -n "$USE_DATABASE_REPLICATED" ]] && [[ "$USE_DATABASE_REPLICATED" -eq 1 ]]; then
ADDITIONAL_OPTIONS+=('--replicated-database')
# Cannot be used with replicated database, due to distributed_ddl_output_mode=none
ADDITIONAL_OPTIONS+=('--no-left-queries-check')
ADDITIONAL_OPTIONS+=('--jobs')
ADDITIONAL_OPTIONS+=('2')
else

View File

@ -375,7 +375,6 @@ class FailureReason(enum.Enum):
RESULT_DIFF = "result differs with reference: "
TOO_LONG = "Test runs too long (> 60s). Make it faster."
INTERNAL_QUERY_FAIL = "Internal query (CREATE/DROP DATABASE) failed:"
LEFT_QUERIES = "Queries left in background after the test finished:"
# SKIPPED reasons
DISABLED = "disabled"
@ -828,21 +827,6 @@ class TestCase:
description,
)
left_queries_check = args.no_left_queries_check is False
if self.tags and "no-left-queries-check" in self.tags:
left_queries_check = False
if left_queries_check:
processlist = get_processlist_after_test(self.testcase_args)
if processlist:
description += f"\n{json.dumps(processlist, indent=4)}\n"
return TestResult(
self.name,
TestStatus.FAIL,
FailureReason.LEFT_QUERIES,
total_time,
description,
)
if os.path.exists(self.stdout_file):
os.remove(self.stdout_file)
if os.path.exists(self.stderr_file):

View File

@ -15,5 +15,3 @@ while [[ $i -lt $retries ]]; do
timeout 1.8s ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&max_distributed_connections=2&max_threads=1" -d "$query" && break
((++i))
done
clickhouse_test_wait_queries 60

View File

@ -10,40 +10,46 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. "$CURDIR"/../shell_config.sh
function thread_create()
{
$CLICKHOUSE_CLIENT --query "CREATE TABLE IF NOT EXISTS $1 (x UInt64, s Array(Nullable(String))) ENGINE = $2"
sleep 0.0$RANDOM
function thread_create {
while true; do
$CLICKHOUSE_CLIENT --query "CREATE TABLE IF NOT EXISTS $1 (x UInt64, s Array(Nullable(String))) ENGINE = $2"
sleep 0.0$RANDOM
done
}
function thread_drop()
{
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS $1"
sleep 0.0$RANDOM
function thread_drop {
while true; do
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS $1"
sleep 0.0$RANDOM
done
}
function thread_rename()
{
$CLICKHOUSE_CLIENT --query "RENAME TABLE $1 TO $2" 2>&1 | grep -v -e 'Received exception from server' -e '^(query: ' | grep -v -P 'Code: (60|57)'
sleep 0.0$RANDOM
function thread_rename {
while true; do
$CLICKHOUSE_CLIENT --query "RENAME TABLE $1 TO $2" 2>&1 | grep -v -e 'Received exception from server' -e '^(query: ' | grep -v -P 'Code: (60|57)'
sleep 0.0$RANDOM
done
}
function thread_select()
{
$CLICKHOUSE_CLIENT --query "SELECT * FROM $1 FORMAT Null" 2>&1 | grep -v -e 'Received exception from server' -e '^(query: ' | grep -v -P 'Code: (60|218)'
sleep 0.0$RANDOM
function thread_select {
while true; do
$CLICKHOUSE_CLIENT --query "SELECT * FROM $1 FORMAT Null" 2>&1 | grep -v -e 'Received exception from server' -e '^(query: ' | grep -v -P 'Code: (60|218)'
sleep 0.0$RANDOM
done
}
function thread_insert()
{
$CLICKHOUSE_CLIENT --query "INSERT INTO $1 SELECT rand64(1), [toString(rand64(2))] FROM numbers($2)" 2>&1 | grep -v -e 'Received exception from server' -e '^(query: '| grep -v -P 'Code: (60|218)'
sleep 0.0$RANDOM
function thread_insert {
while true; do
$CLICKHOUSE_CLIENT --query "INSERT INTO $1 SELECT rand64(1), [toString(rand64(2))] FROM numbers($2)" 2>&1 | grep -v -e 'Received exception from server' -e '^(query: '| grep -v -P 'Code: (60|218)'
sleep 0.0$RANDOM
done
}
function thread_insert_select()
{
$CLICKHOUSE_CLIENT --query "INSERT INTO $1 SELECT * FROM $2" 2>&1 | grep -v -e 'Received exception from server' -e '^(query: ' | grep -v -P 'Code: (60|218)'
sleep 0.0$RANDOM
function thread_insert_select {
while true; do
$CLICKHOUSE_CLIENT --query "INSERT INTO $1 SELECT * FROM $2" 2>&1 | grep -v -e 'Received exception from server' -e '^(query: ' | grep -v -P 'Code: (60|218)'
sleep 0.0$RANDOM
done
}
export -f thread_create
@ -59,18 +65,18 @@ export -f thread_insert_select
function test_with_engine {
echo "Testing $1"
clickhouse_client_loop_timeout 10 thread_create t1 $1 &
clickhouse_client_loop_timeout 10 thread_create t2 $1 &
clickhouse_client_loop_timeout 10 thread_drop t1 &
clickhouse_client_loop_timeout 10 thread_drop t2 &
clickhouse_client_loop_timeout 10 thread_rename t1 t2 &
clickhouse_client_loop_timeout 10 thread_rename t2 t1 &
clickhouse_client_loop_timeout 10 thread_select t1 &
clickhouse_client_loop_timeout 10 thread_select t2 &
clickhouse_client_loop_timeout 10 thread_insert t1 5 &
clickhouse_client_loop_timeout 10 thread_insert t2 10 &
clickhouse_client_loop_timeout 10 thread_insert_select t1 t2 &
clickhouse_client_loop_timeout 10 thread_insert_select t2 t1 &
timeout 10 bash -c "thread_create t1 $1" &
timeout 10 bash -c "thread_create t2 $1" &
timeout 10 bash -c 'thread_drop t1' &
timeout 10 bash -c 'thread_drop t2' &
timeout 10 bash -c 'thread_rename t1 t2' &
timeout 10 bash -c 'thread_rename t2 t1' &
timeout 10 bash -c 'thread_select t1' &
timeout 10 bash -c 'thread_select t2' &
timeout 10 bash -c 'thread_insert t1 5' &
timeout 10 bash -c 'thread_insert t2 10' &
timeout 10 bash -c 'thread_insert_select t1 t2' &
timeout 10 bash -c 'thread_insert_select t2 t1' &
wait
echo "Done $1"

View File

@ -17,9 +17,3 @@ while [[ $counter -lt $retries ]]; do
done
echo 'Ok'
# wait queries, since there is 'Maximum parse depth' error on the client
# and in this case it simply reset the connection and don't read everything
# from server, so there is no guarantee that the query is stopped when the
# client returns
clickhouse_test_wait_queries 60

View File

@ -17,9 +17,3 @@ done
#echo "I = ${I}"
echo 'Ok'
# wait queries, since there is 'Maximum parse depth' error on the client
# and in this case it simply reset the connection and don't read everything
# from server, so there is no guarantee that the query is stopped when the
# client returns
clickhouse_test_wait_queries 60

View File

@ -8,5 +8,3 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# cancellation with async_socket_for_remote=1 (that ignores
# max_distributed_connections)
timeout --signal=SIGINT 1 ${CLICKHOUSE_CLIENT} --max_distributed_connections=1 --max_block_size=2 --interactive_delay=900000 -q "select number + sleep(0.3) as x from remote('127.{2,3}', system.numbers) settings max_block_size = 2" 2>&1 | grep "Empty task was returned from async task queue" || true
clickhouse_test_wait_queries 60

View File

@ -5,19 +5,22 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
$CLICKHOUSE_CLIENT -q 'DROP USER IF EXISTS u02104'
$CLICKHOUSE_CLIENT -q 'CREATE USER IF NOT EXISTS u02104 IDENTIFIED WITH no_password'
$CLICKHOUSE_CLIENT -q 'GRANT ALL ON *.* TO u02104'
$CLICKHOUSE_CLIENT -q 'CREATE USER IF NOT EXISTS u1 IDENTIFIED WITH no_password'
$CLICKHOUSE_CLIENT -q 'GRANT ALL ON *.* TO u1'
function overcommited()
{
$CLICKHOUSE_CLIENT -u u02104 -q 'SELECT number FROM numbers(130000) GROUP BY number SETTINGS memory_overcommit_ratio_denominator=1,memory_usage_overcommit_max_wait_microseconds=500' 2>&1 \
| grep -F -q "MEMORY_LIMIT_EXCEEDED" && echo "OVERCOMMITED WITH USER LIMIT IS KILLED"
while true; do
$CLICKHOUSE_CLIENT -u u02104 -q 'SELECT number FROM numbers(130000) GROUP BY number SETTINGS memory_overcommit_ratio_denominator=1,memory_usage_overcommit_max_wait_microseconds=500' 2>&1 \
| grep -F -q "MEMORY_LIMIT_EXCEEDED" && echo "OVERCOMMITED WITH USER LIMIT IS KILLED"
done
}
function expect_execution()
{
$CLICKHOUSE_CLIENT -u u02104 -q 'SELECT number FROM numbers(130000) GROUP BY number SETTINGS max_memory_usage_for_user=5000000,memory_overcommit_ratio_denominator=2,memory_usage_overcommit_max_wait_microseconds=500' >/dev/null 2>/dev/null
while true; do
$CLICKHOUSE_CLIENT -u u02104 -q 'SELECT number FROM numbers(130000) GROUP BY number SETTINGS max_memory_usage_for_user=5000000,memory_overcommit_ratio_denominator=2,memory_usage_overcommit_max_wait_microseconds=500' >/dev/null 2>/dev/null
done
}
export -f overcommited
@ -27,9 +30,9 @@ function user_test()
{
for _ in {1..10};
do
clickhouse_client_loop_timeout 10 overcommited &
clickhouse_client_loop_timeout 10 expect_execution &
done
timeout 10 bash -c overcommited &
timeout 10 bash -c expect_execution &
done;
wait
}
@ -43,4 +46,4 @@ else
echo "OVERCOMMITED WITH USER LIMIT WAS KILLED"
fi
$CLICKHOUSE_CLIENT -q 'DROP USER IF EXISTS u02104'
$CLICKHOUSE_CLIENT -q 'DROP USER IF EXISTS u1'

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash
# Tags: long
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
@ -26,9 +25,3 @@ timeout 0.15s ${CLICKHOUSE_CURL} -sS -F "s=@$tmp_file;" "${CLICKHOUSE_URL}&s_str
echo $?
timeout 0.15s ${CLICKHOUSE_CURL} -sS -F "s=@$tmp_file;" "${CLICKHOUSE_URL}&s_structure=key+Int&query=SELECT+dummy+IN+s&input_format_parallel_parsing=false" -o /dev/null
echo $?
# wait until the query above will start,
# so that clickhouse_test_wait_queries will see them.
sleep 5
clickhouse_test_wait_queries 60