Files
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

46 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -e
WORK_TREE="$1"
(
cd $WORK_TREE || exit 1
echo "$PWD"
cat << EOF > /tmp/query.sql
SET enable_analyzer=1;
SET query_plan_merge_filters = 0;
SELECT version();
DROP FUNCTION IF EXISTS het2Bytes;
DROP FUNCTION IF EXISTS unhexPrefixed;
DROP TABLE IF EXISTS t;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
CREATE FUNCTION het2Bytes AS (x) -> CAST(unhexPrefixed(x), 'FixedString(20)');
CREATE FUNCTION unhexPrefixed AS VALUE -> unhex(substr(VALUE, 3));
CREATE TABLE t ENGINE=MergeTree ORDER BY tuple() AS SELECT arrayJoin(['4D7953514C', 'выьдыьдыдлтьыфвдльждлцьуфлоьфьс']) AS s;
CREATE TABLE t2 ENGINE=MergeTree ORDER BY tuple() AS SELECT het2Bytes('4D7953514C') AS s;
CREATE TABLE t3 ENGINE=MergeTree ORDER BY (c, s) AS SELECT s, s LIKE '4%' AS c FROM t;
SELECT * FROM t;
SELECT * FROM t2;
SELECT * FROM t3;
WITH cte1 AS
(SELECT t3.s AS s3, t2.s AS s2, t3.c AS c FROM t3 INNER JOIN t2 ON het2Bytes(t3.s) = t2.s WHERE t3.c)
SELECT 'OK', * FROM cte1;
WITH cte1 AS
(SELECT t3.s AS s3, t2.s AS s2, t3.c AS c FROM t3 INNER JOIN t2 ON het2Bytes(t3.s) = t2.s WHERE t3.c)
SELECT * FROM cte1 WHERE s2 IN (SELECT DISTINCT s2 FROM cte1);
EOF
# CH_PATH is the path to downloaded binary
! $CH_PATH client --queries-file /tmp/query.sql 2>&1
)