Skip to content

Commit bbc2118

Browse files
clickhouse-parquet: run queries through clickhouse-server
Instead of a `clickhouse-local` process per query, run `clickhouse-server` from the entry directory (as `clickhouse-iceberg` does) and query the `File(Parquet)` table with `clickhouse-client`. This enables the concurrent QPS test, which was skipped for the single-process engine, and also avoids the 26.11 `clickhouse-local` persistence issue without `--tmp`, so it works with any release. The Parquet files are symlinked into the server's `user_files` directory and read in place. #3158 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 0f212fd commit bbc2118

20 files changed

Lines changed: 138 additions & 50 deletions

File tree

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
11
#!/bin/bash
22
export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned"
3-
export BENCH_RESTARTABLE=no
4-
# Single-process engine: each query forks a fresh full-machine process with no
5-
# shared scheduler across connections, so the concurrent-QPS test only
6-
# oversubscribes RAM rather than measuring throughput. Skip it by default;
7-
# override BENCH_CONCURRENT_DURATION to re-enable. See issue #946.
8-
export BENCH_CONCURRENT_DURATION="${BENCH_CONCURRENT_DURATION:-0}"
93
exec ../lib/benchmark-common.sh
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
#!/bin/bash
2-
set -e
3-
4-
./clickhouse local --tmp --query "SELECT 1" >/dev/null
2+
# The benchmark driver discards the output of ./start but prints the stderr
3+
# of the last failed ./check, so on failure we add the end of the server logs.
4+
if ! ./clickhouse client --query "SELECT 1" >/dev/null; then
5+
for f in server-data/stdout.log server-data/clickhouse-server.err.log; do
6+
if [ -f "$f" ]; then
7+
echo "The end of $f:" >&2
8+
tail -n 20 "$f" >&2
9+
fi
10+
done
11+
exit 1
12+
fi
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# A minimal configuration of clickhouse-server running from the entry
2+
# directory. Everything not listed here is the default.
3+
path: ./server-data/
4+
# Relative to `path`.
5+
tmp_path: ./tmp/
6+
user_files_path: ./user_files/
7+
logger:
8+
level: information
9+
log: ./server-data/clickhouse-server.log
10+
errorlog: ./server-data/clickhouse-server.err.log
11+
tcp_port: 9000
12+
http_port: 8123
13+
listen_host: 127.0.0.1
14+
users_config: users.yaml

‎clickhouse-parquet-partitioned/install‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ set -e -o pipefail
44
if [ ! -x ./clickhouse ]; then
55
curl -fsSL --retry 10 --retry-delay 60 --retry-all-errors https://clickhouse.com/ | sh
66
fi
7+
# The binary is self-extracting: it decompresses itself on the first run.
8+
# Do it here, rather than when ./start and ./check run it at the same time.
9+
./clickhouse --version
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
#!/bin/bash
22
set -e
33

4-
# clickhouse-local with File(Parquet, 'hits_*.parquet') reads the parquet files
5-
# in place, so there's no separate ingest step. Keep the downloaded
6-
# hits_*.parquet files in this directory.
4+
# The File(Parquet) table reads the parquet files in place, so there is no
5+
# ingest step. The server resolves the path of the table relative to its
6+
# user_files directory: symlink the files there and keep them for the queries.
7+
mkdir -p server-data/user_files
8+
for f in hits_*.parquet; do
9+
ln -sf "$PWD/$f" "server-data/user_files/$f"
10+
done
11+
12+
./clickhouse client < create.sql
713
sync
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
#!/bin/bash
2-
# Reads a SQL query from stdin, runs it via clickhouse-local with the table
3-
# definition from create.sql prepended. Stdout: query result. Stderr: query
4-
# runtime in fractional seconds on the last line. Exit non-zero on error.
5-
# --tmp: since 26.11, clickhouse-local keeps its databases in
6-
# ~/.local/share/clickhouse-local, and `hits` would already exist in the second
7-
# query.
2+
# Reads a SQL query from stdin, runs it via clickhouse-client.
3+
# Stdout: query result. Stderr: query runtime in fractional seconds on the
4+
# last line (from --time). Exit non-zero on error.
85
set -e
96

10-
query=$(cat)
11-
./clickhouse local --tmp --time --format=Pretty --query="$(cat create.sql); ${query}"
7+
./clickhouse client --time --format=Pretty
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
#!/bin/bash
2-
# clickhouse-local is invoked per-query — no daemon to start.
3-
exit 0
2+
set -e
3+
4+
if ! [ -f server-data/clickhouse.pid ] || ! kill -0 "$(cat server-data/clickhouse.pid)" 2>/dev/null; then
5+
mkdir -p server-data
6+
setsid nohup ./clickhouse server --config-file=config.yaml --pid-file=server-data/clickhouse.pid \
7+
> server-data/stdout.log 2>&1 < /dev/null &
8+
fi
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
#!/bin/bash
2-
# clickhouse-local is invoked per-query — no daemon to stop.
3-
exit 0
2+
3+
[ -f server-data/clickhouse.pid ] || exit 0
4+
pid=$(cat server-data/clickhouse.pid)
5+
kill "$pid" 2>/dev/null || exit 0
6+
for _ in $(seq 1 60); do
7+
kill -0 "$pid" 2>/dev/null || exit 0
8+
sleep 1
9+
done
10+
kill -9 "$pid" 2>/dev/null || true

‎clickhouse-parquet-partitioned/template.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"tags": [
77
"C++",
88
"column-oriented",
9-
"embedded",
109
"stateless",
1110
"ClickHouse derivative"
1211
]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
profiles:
2+
default: {}
3+
users:
4+
default:
5+
password: ''
6+
networks:
7+
ip: '::/0'
8+
profile: default
9+
quota: default
10+
access_management: 1
11+
quotas:
12+
default: {}

0 commit comments

Comments
 (0)