2022-09-18 09:51:33 +00:00
|
|
|
#!/usr/bin/env bash
|
2024-02-15 04:12:59 +00:00
|
|
|
# Tags: long, no-random-settings, no-debug
|
2022-09-18 09:51:33 +00:00
|
|
|
|
|
|
|
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
# shellcheck source=../shell_config.sh
|
|
|
|
. "$CUR_DIR"/../shell_config.sh
|
|
|
|
|
|
|
|
# Test that running distributed query and cancel it ASAP,
|
|
|
|
# this can trigger a hung/deadlock in ProcessorList.
|
2023-08-03 10:48:24 +00:00
|
|
|
for i in {1..50}; do
|
2022-09-18 09:51:33 +00:00
|
|
|
query_id="$CLICKHOUSE_TEST_UNIQUE_NAME-$i"
|
|
|
|
$CLICKHOUSE_CLIENT --format Null --query_id "$query_id" -q "select * from remote('127.{1|2|3|4|5|6}', numbers(1e12))" 2>/dev/null &
|
|
|
|
while :; do
|
|
|
|
killed_queries="$($CLICKHOUSE_CLIENT -q "kill query where query_id = '$query_id' sync" | wc -l)"
|
|
|
|
if [[ "$killed_queries" -ge 1 ]]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
wait -n
|
|
|
|
query_return_status=$?
|
|
|
|
if [[ $query_return_status -eq 0 ]]; then
|
|
|
|
echo "Query $query_id should be cancelled, however it returns successfully"
|
|
|
|
fi
|
|
|
|
done
|