This commit is contained in:
Nikita Taranov 2024-05-28 20:18:36 +01:00
parent 016d665328
commit 512fa6afbb

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Tags: long, distributed, no-tsan, no-debug
# Tags: long, distributed, no-debug, no-tsan, no-msan, no-ubsan, no-asan, no-random-settings, no-random-merge-tree-settings
# These tests don't use `current_database = currentDatabase()` condition, because database name isn't propagated during remote queries.
@ -49,26 +49,18 @@ run_query() {
}
check_preallocated_elements() {
$CLICKHOUSE_CLIENT -q "SYSTEM FLUSH LOGS"
# rows may be distributed in any way including "everything goes to the one particular thread"
min=$1
if [ -z "$2" ]; then
max=$1
else
max=$2
fi
$CLICKHOUSE_CLIENT --param_query_id="$query_id" -q "
$CLICKHOUSE_CLIENT --param_query_id="$1" -q "
SELECT COUNT(*)
FROM system.query_log
WHERE event_date >= yesterday() AND (query_id = {query_id:String} OR initial_query_id = {query_id:String})
AND ProfileEvents['AggregationPreallocatedElementsInHashTables'] BETWEEN $min AND $max
AND ProfileEvents['AggregationPreallocatedElementsInHashTables'] BETWEEN $2 AND $3
GROUP BY query_id"
}
check_convertion_to_two_level() {
$CLICKHOUSE_CLIENT -q "SYSTEM FLUSH LOGS"
# rows may be distributed in any way including "everything goes to the one particular thread"
$CLICKHOUSE_CLIENT --param_query_id="$query_id" -q "
$CLICKHOUSE_CLIENT --param_query_id="$1" -q "
SELECT SUM(ProfileEvents['AggregationHashTablesInitializedAsTwoLevel']) BETWEEN 1 AND $max_threads
FROM system.query_log
WHERE event_date >= yesterday() AND (query_id = {query_id:String} OR initial_query_id = {query_id:String})
@ -79,11 +71,25 @@ print_border() {
echo "--"
}
# each test case appends to this array
expected_results=()
check_expectations() {
$CLICKHOUSE_CLIENT -q "SYSTEM FLUSH LOGS"
for i in "${!expected_results[@]}"; do
read -a args <<< "${expected_results[$i]}"
if [ ${#args[@]} -eq 4 ]; then
check_convertion_to_two_level "${args[0]}"
fi
check_preallocated_elements "${args[@]}"
print_border
done
}
# shellcheck source=./02151_hash_table_sizes_stats.testcases
source "$CURDIR"/02151_hash_table_sizes_stats.testcases
test_one_thread_simple_group_by
test_one_thread_simple_group_by_with_limit
test_one_thread_simple_group_by_with_join_and_subquery
@ -93,3 +99,5 @@ test_several_threads_simple_group_by_with_limit_and_rollup_single_level_ht
test_several_threads_simple_group_by_with_limit_and_rollup_two_level_ht
test_several_threads_simple_group_by_with_limit_and_cube_single_level_ht
test_several_threads_simple_group_by_with_limit_and_cube_two_level_ht
check_expectations