mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Use system.text_log in test
This commit is contained in:
parent
ebfb013ea1
commit
a07ce98121
@ -4,8 +4,7 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|||||||
# shellcheck source=../shell_config.sh
|
# shellcheck source=../shell_config.sh
|
||||||
. "$CURDIR"/../shell_config.sh
|
. "$CURDIR"/../shell_config.sh
|
||||||
|
|
||||||
function wait_for_query_to_start()
|
function wait_for_query_to_start() {
|
||||||
{
|
|
||||||
while [[ $($CLICKHOUSE_CURL -sS "$CLICKHOUSE_URL" -d "SELECT sum(read_rows) FROM system.processes WHERE query_id = '$1'") == 0 ]]; do sleep 0.1; done
|
while [[ $($CLICKHOUSE_CURL -sS "$CLICKHOUSE_URL" -d "SELECT sum(read_rows) FROM system.processes WHERE query_id = '$1'") == 0 ]]; do sleep 0.1; done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,14 +20,14 @@ insert into simple select number, number + 100 from numbers(5000);
|
|||||||
query_id="long_running_query-$CLICKHOUSE_DATABASE"
|
query_id="long_running_query-$CLICKHOUSE_DATABASE"
|
||||||
|
|
||||||
echo "Spin up a long running query"
|
echo "Spin up a long running query"
|
||||||
${CLICKHOUSE_CLIENT} --query "select sleepEachRow(0.1) from simple settings max_block_size = 1 format Null" --query_id "$query_id" > /dev/null 2>&1 &
|
${CLICKHOUSE_CLIENT} --query "select sleepEachRow(0.1) from simple settings max_block_size = 1 format Null" --query_id "$query_id" >/dev/null 2>&1 &
|
||||||
wait_for_query_to_start "$query_id"
|
wait_for_query_to_start "$query_id"
|
||||||
|
|
||||||
# query which reads marks >= min_marks_to_honor_max_concurrent_queries is throttled
|
# query which reads marks >= min_marks_to_honor_max_concurrent_queries is throttled
|
||||||
echo "Check if another query with some marks to read is throttled"
|
echo "Check if another query with some marks to read is throttled"
|
||||||
${CLICKHOUSE_CLIENT} --query "select * from simple" 2> /dev/null;
|
${CLICKHOUSE_CLIENT} --query "select * from simple" 2>/dev/null
|
||||||
CODE=$?
|
CODE=$?
|
||||||
[ "$CODE" -ne "202" ] && echo "Expected error code: 202 but got: $CODE" && exit 1;
|
[ "$CODE" -ne "202" ] && echo "Expected error code: 202 but got: $CODE" && exit 1
|
||||||
echo "yes"
|
echo "yes"
|
||||||
|
|
||||||
# query which reads marks less than min_marks_to_honor_max_concurrent_queries is allowed
|
# query which reads marks less than min_marks_to_honor_max_concurrent_queries is allowed
|
||||||
@ -41,9 +40,9 @@ ${CLICKHOUSE_CLIENT} --query "alter table simple modify setting min_marks_to_hon
|
|||||||
|
|
||||||
# Now smaller queries are also throttled
|
# Now smaller queries are also throttled
|
||||||
echo "Check if another query with less marks to read is throttled"
|
echo "Check if another query with less marks to read is throttled"
|
||||||
${CLICKHOUSE_CLIENT} --query "select * from simple where i = 0" 2> /dev/null;
|
${CLICKHOUSE_CLIENT} --query "select * from simple where i = 0" 2>/dev/null
|
||||||
CODE=$?
|
CODE=$?
|
||||||
[ "$CODE" -ne "202" ] && echo "Expected error code: 202 but got: $CODE" && exit 1;
|
[ "$CODE" -ne "202" ] && echo "Expected error code: 202 but got: $CODE" && exit 1
|
||||||
echo "yes"
|
echo "yes"
|
||||||
|
|
||||||
echo "Modify max_concurrent_queries to 2"
|
echo "Modify max_concurrent_queries to 2"
|
||||||
@ -58,9 +57,9 @@ ${CLICKHOUSE_CLIENT} --query "alter table simple modify setting max_concurrent_q
|
|||||||
|
|
||||||
# Now queries are throttled again
|
# Now queries are throttled again
|
||||||
echo "Check if another query with less marks to read is throttled"
|
echo "Check if another query with less marks to read is throttled"
|
||||||
${CLICKHOUSE_CLIENT} --query "select * from simple where i = 0" 2> /dev/null;
|
${CLICKHOUSE_CLIENT} --query "select * from simple where i = 0" 2>/dev/null
|
||||||
CODE=$?
|
CODE=$?
|
||||||
[ "$CODE" -ne "202" ] && echo "Expected error code: 202 but got: $CODE" && exit 1;
|
[ "$CODE" -ne "202" ] && echo "Expected error code: 202 but got: $CODE" && exit 1
|
||||||
echo "yes"
|
echo "yes"
|
||||||
|
|
||||||
${CLICKHOUSE_CLIENT} --query "KILL QUERY WHERE query_id = '$query_id' SYNC FORMAT Null"
|
${CLICKHOUSE_CLIENT} --query "KILL QUERY WHERE query_id = '$query_id' SYNC FORMAT Null"
|
||||||
@ -70,10 +69,9 @@ wait
|
|||||||
query_id=max_concurrent_queries_$RANDOM
|
query_id=max_concurrent_queries_$RANDOM
|
||||||
${CLICKHOUSE_CLIENT} --query_id "$query_id" --query "select i from simple where j in (select i from simple where i < 10)"
|
${CLICKHOUSE_CLIENT} --query_id "$query_id" --query "select i from simple where j in (select i from simple where i < 10)"
|
||||||
|
|
||||||
# We have to grep the server's error log because the following warning message
|
# We have to search the server's error log because the following warning message
|
||||||
# is generated during pipeline destruction and thus is not sent to the client.
|
# is generated during pipeline destruction and thus is not sent to the client.
|
||||||
grep -E -q "{$query_id} <Warning>.*We have query_id removed but it's not recorded. This is a bug" /var/log/clickhouse-server/clickhouse-server.err.log && exit 1
|
${CLICKHOUSE_CLIENT} --query "system flush logs"
|
||||||
|
if [[ $(${CLICKHOUSE_CLIENT} --query "select count() > 0 from system.text_log where query_id = '$query_id' and level = 'Warning' and message like '%We have query_id removed but it\'s not recorded. This is a bug%' format TSVRaw") == 1 ]]; then echo "We have query_id removed but it's not recorded. This is a bug." >&2; exit 1; fi
|
||||||
|
|
||||||
${CLICKHOUSE_CLIENT} --multiline --multiquery --query "
|
${CLICKHOUSE_CLIENT} --query "drop table simple"
|
||||||
drop table simple
|
|
||||||
"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user