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

51 lines
993 B
Bash
Executable File

#!/bin/bash
set -e
echo "$PWD"
CH_PATH=${CH_PATH:=clickhouse}
VIEW_NAME="x"
$CH_PATH client -mn -q "
drop table if exists tttt;
CREATE TABLE IF NOT EXISTS tttt
(
wwww UInt32,
qqqq1 DateTime64(3),
eeeee DateTime64(3),
rrrrr Decimal32(2),
ttttttt Decimal32(2)
)
ENGINE = ReplacingMergeTree(eeeee)
PARTITION BY toYYYYMM(qqqq1)
ORDER BY (wwww, qqqq1);
CREATE OR REPLACE VIEW $VIEW_NAME
AS SELECT
wwww,
qqqq1,
rrrrr
FROM tttt
FINAL
COMMENT 'comment'
;
"
# Extract create_table_query and calculate positions
# We use position() inside ClickHouse for a cleaner, high-performance check
RESULT=$($CH_PATH client -q "
SELECT
if(position(create_table_query, 'COMMENT') < position(create_table_query, 'AS SELECT'), 1, 0)
FROM system.tables
WHERE name = '$VIEW_NAME'
")
if [ "$RESULT" -eq "1" ]; then
echo "Logic Match: COMMENT is at the beginning. Exiting with 1."
exit 1
else
echo "Logic Match: COMMENT is at the end. Exiting with 0."
exit 0
fi