ClickHouse/docker/test/clickbench/run.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

80 lines
1.8 KiB
Bash
Raw Normal View History

2023-12-09 22:31:05 +00:00
#!/bin/bash
2023-12-13 16:59:55 +00:00
SCRIPT_PID=$!
(sleep 1200 && kill -9 $SCRIPT_PID) &
2023-12-09 22:31:05 +00:00
# shellcheck disable=SC1091
source /setup_export_logs.sh
# fail on errors, verbose and export all env variables
set -e -x -a
dpkg -i package_folder/clickhouse-common-static_*.deb
dpkg -i package_folder/clickhouse-server_*.deb
dpkg -i package_folder/clickhouse-client_*.deb
# A directory for cache
2023-12-10 22:53:22 +00:00
mkdir /dev/shm/clickhouse
chown clickhouse:clickhouse /dev/shm/clickhouse
2023-12-09 22:31:05 +00:00
2023-12-12 04:04:37 +00:00
# Allow introspection functions, needed for sending the logs
echo "
profiles:
default:
allow_introspection_functions: 1
2023-12-12 18:33:08 +00:00
" > /etc/clickhouse-server/users.d/allow_introspection_functions.yaml
2023-12-12 04:04:37 +00:00
2023-12-12 20:28:28 +00:00
# Enable text_log
echo "
text_log:
" > /etc/clickhouse-server/config.d/text_log.yaml
2023-12-12 18:33:08 +00:00
config_logs_export_cluster /etc/clickhouse-server/config.d/system_logs_export.yaml
2023-12-12 04:04:37 +00:00
2023-12-10 22:53:22 +00:00
clickhouse start
2023-12-09 22:31:05 +00:00
# Wait for the server to start, but not for too long.
for _ in {1..100}
do
clickhouse-client --query "SELECT 1" && break
sleep 1
done
setup_logs_replication
# Load the data
clickhouse-client --time < /create.sql
# Run the queries
2023-12-11 16:21:02 +00:00
set +x
2023-12-09 22:31:05 +00:00
TRIES=3
QUERY_NUM=1
2023-12-10 18:06:38 +00:00
while read -r query; do
2023-12-09 22:31:05 +00:00
echo -n "["
for i in $(seq 1 $TRIES); do
2023-12-13 21:12:53 +00:00
RES=$(clickhouse-client --query_id "q${QUERY_NUM}-${i}" --time --format Null --query "$query" --progress 0 2>&1 ||:)
2023-12-09 23:19:30 +00:00
echo -n "${RES}"
[[ "$i" != "$TRIES" ]] && echo -n ", "
2023-12-09 22:31:05 +00:00
echo "${QUERY_NUM},${i},${RES}" >> /test_output/test_results.tsv
done
echo "],"
QUERY_NUM=$((QUERY_NUM + 1))
2023-12-09 23:19:30 +00:00
done < /queries.sql
2023-12-09 22:31:05 +00:00
2023-12-11 16:21:02 +00:00
set -x
2023-12-09 22:31:05 +00:00
clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'"
2023-12-12 03:55:16 +00:00
clickhouse-client -q "system flush logs" ||:
stop_logs_replication
2023-12-12 15:42:31 +00:00
clickhouse stop
2023-12-12 03:55:16 +00:00
2023-12-12 04:48:09 +00:00
mv /var/log/clickhouse-server/* /test_output/
2023-12-09 22:31:05 +00:00
echo -e "success\tClickBench finished" > /test_output/check_status.tsv