Files
datastore/utils/auto-bisect/tests/test_pruning_degradation.sh
Nikita Fomichev a78bcc708e utils: add auto-bisect script for ClickHouse regression bisection
Adds `utils/auto-bisect/` — a shell-based bisection framework that
downloads pre-built CI binaries and runs a user-supplied test script
to find the first bad commit.

Key features:
- Downloads public CI binaries from S3 by default; private CloudFront
  builds with `--private` (credentials via `CH_CI_BASIC_AUTH` env var,
  `CH_CI_USER`/`CH_CI_PASSWORD`, or `/etc/netrc`)
- Three environment modes: `single` (one server), `replicateddb` (two
  nodes + Keeper, Replicated database), `sharedcatalog` (two nodes +
  Keeper, SharedCatalog)
- Uses `git bisect --no-checkout` by default so the work tree is not
  modified during bisection
- Walker mode (`--walker`) for linear commit-by-commit testing
- Example test scripts in `tests/`

Tested locally: `--env nothing`, `--env single`, and `--env replicateddb`
all verified working.
2026-03-28 10:39:03 +01:00

41 lines
957 B
Bash
Executable File

#!/bin/bash
set -e
echo "$PWD"
CH_PATH=${CH_PATH:=clickhouse}
$CH_PATH client -q "SELECT version()"
$CH_PATH client -mn -q "
DROP TABLE IF EXISTS kek;
CREATE TABLE kek (id Int) ENGINE = Memory();
INSERT INTO kek VALUES (2);
"
RANDOM_ID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
echo "RANDOM_ID: $RANDOM_ID"
$CH_PATH client -mn --query_id $RANDOM_ID -q "
SELECT * FROM icebergS3('http://localhost:11111/test/warehouse/default/test_pruning_degradation_1', 'clickhouse', 'clickhouse')
WHERE id IN (SELECT * FROM kek) SETTINGS use_iceberg_partition_pruning = 1;
"
Query="SYSTEM FLUSH LOGS; SELECT
ProfileEvents['IcebergPartitionPrunedFiles']
FROM system.query_log
WHERE query_id == '$RANDOM_ID' AND type == 'QueryFinish';"
RESULT=$($CH_PATH client -mn -q "$Query")
echo "$RESULT"
if [ "$RESULT" -gt 0 ]; then
echo "✓ Test passed: $RESULT > 0"
exit 0
else
echo "✗ Test failed: $RESULT <= 0"
exit 1
fi