Get back 01281_group_by_limit_memory_tracking (without flackiness)

This commit is contained in:
Azat Khuzhin 2020-05-21 23:58:55 +03:00
parent 36c7a486a1
commit aa5247f1fe
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,34 @@
#!/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