mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-10-18 22:40:50 +00:00
35 lines
878 B
Bash
Executable File
35 lines
878 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Regression for MemoryTracker that had been incorrectly accounted
|
|
# (it was reseted before deallocation)
|
|
#
|
|
# For this will be used:
|
|
# - two-level group by
|
|
# - max_memory_usage_for_user
|
|
# - one users' query in background (to avoid reseting max_memory_usage_for_user)
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
. $CURDIR/../shell_config.sh
|
|
|
|
set -o pipefail
|
|
|
|
function execute_null()
|
|
{
|
|
${CLICKHOUSE_CLIENT} --format Null -n "$@"
|
|
}
|
|
|
|
function execute_group_by()
|
|
{
|
|
local opts=(
|
|
--max_memory_usage_for_user=$((150<<20))
|
|
--max_threads=2
|
|
)
|
|
execute_null "${opts[@]}" <<<'SELECT uniq(number) FROM numbers_mt(toUInt64(1e6)) GROUP BY number % 5e5'
|
|
}
|
|
|
|
execute_null <<<'SELECT sleep(3)' &
|
|
execute_group_by
|
|
# if memory accounting will be incorrect, the second query will be failed with MEMORY_LIMIT_EXCEEDED
|
|
execute_group_by
|
|
wait
|