2020-07-12 02:31:58 +00:00
|
|
|
#!/usr/bin/env bash
|
2024-09-23 16:36:00 +00:00
|
|
|
# Tags: no-fasttest
|
|
|
|
# no-fasttest: Can be slow and resource intensive
|
2020-07-12 02:31:58 +00:00
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
CLICKHOUSE_CLIENT_SERVER_LOGS_LEVEL=none
|
2020-12-28 11:46:53 +00:00
|
|
|
# shellcheck source=../shell_config.sh
|
2020-08-01 00:51:12 +00:00
|
|
|
. "$CURDIR"/../shell_config.sh
|
2020-07-12 02:31:58 +00:00
|
|
|
|
|
|
|
|
2020-12-21 21:55:54 +00:00
|
|
|
function test_func()
|
2020-07-12 02:31:58 +00:00
|
|
|
{
|
|
|
|
ENGINE=$1
|
|
|
|
MAX_MEM=4096
|
|
|
|
|
|
|
|
echo "Testing $ENGINE"
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT --query "DROP TABLE IF EXISTS log";
|
|
|
|
$CLICKHOUSE_CLIENT --query "CREATE TABLE log (x UInt64, y UInt64, z UInt64) ENGINE = $ENGINE";
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
MAX_MEM=$((2 * $MAX_MEM))
|
|
|
|
|
2020-08-01 00:56:32 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query "INSERT INTO log SELECT number, number, number FROM numbers(1000000)" --max_memory_usage $MAX_MEM > "${CLICKHOUSE_TMP}"/insert_result 2>&1
|
2024-02-27 18:33:15 +00:00
|
|
|
RES=$?
|
2020-07-12 02:31:58 +00:00
|
|
|
|
2024-10-30 19:14:31 +00:00
|
|
|
grep -o -F 'emory limit' "${CLICKHOUSE_TMP}"/insert_result || cat "${CLICKHOUSE_TMP}"/insert_result
|
2020-07-12 02:31:58 +00:00
|
|
|
|
2020-08-01 00:56:32 +00:00
|
|
|
$CLICKHOUSE_CLIENT --query "SELECT count(), sum(x + y + z) FROM log" > "${CLICKHOUSE_TMP}"/select_result 2>&1;
|
2020-07-12 02:31:58 +00:00
|
|
|
|
2021-01-03 16:12:22 +00:00
|
|
|
cat "${CLICKHOUSE_TMP}"/select_result
|
2020-07-12 02:31:58 +00:00
|
|
|
|
2024-02-27 18:33:15 +00:00
|
|
|
{ [[ $RES -eq 0 ]] || [[ $MAX_MEM -gt 200000000 ]]; } && break;
|
2020-07-12 02:31:58 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
$CLICKHOUSE_CLIENT --query "DROP TABLE log";
|
|
|
|
}
|
|
|
|
|
2024-10-30 19:14:31 +00:00
|
|
|
test_func TinyLog | grep -v -P '^(emory limit|0\t0|[1-9]000000\t)'
|
|
|
|
test_func StripeLog | grep -v -P '^(emory limit|0\t0|[1-9]000000\t)'
|
|
|
|
test_func Log | grep -v -P '^(emory limit|0\t0|[1-9]000000\t)'
|
2020-07-12 02:31:58 +00:00
|
|
|
|
|
|
|
rm "${CLICKHOUSE_TMP}/insert_result"
|
|
|
|
rm "${CLICKHOUSE_TMP}/select_result"
|