Add a test for max_untracked_memory (both HTTP and TCP)

This commit is contained in:
Azat Khuzhin 2020-10-16 22:22:14 +03:00
parent fea788480f
commit 42395053e4
4 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,2 @@
1
1

View File

@ -0,0 +1,31 @@
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. "$CURDIR"/../shell_config.sh
query="select randomPrintableASCII(number) from numbers(1000)"
# at least 2, one allocation, one deallocation
# (but actually even more)
min_trace_entries=2
#
# TCP
# do not use _, they should be escaped for LIKE
query_id_tcp_prefix="01526-tcp-memory-tracking-$RANDOM-$$"
${CLICKHOUSE_CLIENT} --log_queries=1 --max_threads=1 --max_untracked_memory=0 --memory_profiler_sample_probability=1 -q "with '$query_id_tcp_prefix' as __id $query FORMAT Null"
${CLICKHOUSE_CLIENT} -q "SYSTEM FLUSH LOGS"
query_id_tcp="$(${CLICKHOUSE_CLIENT} -q "SELECT DISTINCT query_id FROM system.query_log WHERE query LIKE '%$query_id_tcp_prefix%'")"
${CLICKHOUSE_CLIENT} -q "SELECT count()>=$min_trace_entries FROM system.trace_log WHERE query_id = '$query_id_tcp' AND abs(size) < 4e6 AND event_time >= now() - interval 1 hour"
#
# HTTP
#
# query_id cannot be longer then 28 bytes
query_id_http="01526_http_${RANDOM}_$$"
echo "$query" | ${CLICKHOUSE_CURL} -sSg -o /dev/null "${CLICKHOUSE_URL}&query_id=$query_id_http&max_untracked_memory=0&memory_profiler_sample_probability=1&max_threads=1" -d @-
${CLICKHOUSE_CLIENT} -q "SYSTEM FLUSH LOGS"
# at least 2, one allocation, one deallocation
# (but actually even more)
${CLICKHOUSE_CLIENT} -q "SELECT count()>=$min_trace_entries FROM system.trace_log WHERE query_id = '$query_id_http' AND abs(size) < 4e6 AND event_time >= now() - interval 1 hour"

View File

@ -153,3 +153,4 @@
01515_force_data_skipping_indices
01526_complex_key_dict_direct_layout
01509_dictionary_preallocate
01526_max_untracked_memory

View File

@ -18,6 +18,7 @@
"00157_cache_dictionary",
"01193_metadata_loading",
"01473_event_time_microseconds",
"01526_max_untracked_memory", /// requires TraceCollector, does not available under sanitizers
"01474_executable_dictionary" /// informational stderr from sanitizer at start
],
"address-sanitizer": [
@ -27,6 +28,7 @@
"odbc_roundtrip",
"01103_check_cpu_instructions_at_startup",
"01473_event_time_microseconds",
"01526_max_untracked_memory", /// requires TraceCollector, does not available under sanitizers
"01193_metadata_loading"
],
"ub-sanitizer": [
@ -36,6 +38,7 @@
"01103_check_cpu_instructions_at_startup",
"00900_orc_load",
"01473_event_time_microseconds",
"01526_max_untracked_memory", /// requires TraceCollector, does not available under sanitizers
"01193_metadata_loading"
],
"memory-sanitizer": [
@ -47,6 +50,7 @@
"00877_memory_limit_for_new_delete", /// memory limits don't work correctly under msan because it replaces malloc/free
"01114_mysql_database_engine_segfault", /// it fails in _nss_files_parse_servent while using NSS from GLibc to authenticate (need to get rid of it)
"01473_event_time_microseconds",
"01526_max_untracked_memory", /// requires TraceCollector, does not available under sanitizers
"01193_metadata_loading"
],
"debug-build": [