mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
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.
47 lines
1.1 KiB
Bash
Executable File
47 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
CH_PATH=${CH_PATH:=clickhouse}
|
|
|
|
WORK_TREE="$1"
|
|
|
|
(
|
|
if [ -n "$WORK_TREE" ]; then
|
|
cd "$WORK_TREE" || exit 129
|
|
fi
|
|
$CH_PATH client --user admin -mn -q "
|
|
drop table if exists source_table;
|
|
drop table if exists target_table;
|
|
drop user if exists definer_user;
|
|
drop user if exists user;
|
|
|
|
|
|
CREATE TABLE source_table (x UInt32) ENGINE = MergeTree ORDER BY x;
|
|
CREATE TABLE target_table (x UInt32) ENGINE = MergeTree ORDER BY x;
|
|
|
|
|
|
CREATE USER definer_user;
|
|
GRANT SELECT ON source_table TO definer_user;
|
|
GRANT INSERT ON source_table TO definer_user;
|
|
GRANT SELECT ON target_table TO definer_user;
|
|
GRANT NONE ON target_table TO definer_user;
|
|
|
|
CREATE MATERIALIZED VIEW mv TO target_table DEFINER = definer_user SQL SECURITY DEFINER AS SELECT * FROM source_table;
|
|
CREATE USER user;
|
|
|
|
GRANT SELECT ON mv TO user;
|
|
GRANT INSERT ON mv TO user;
|
|
GRANT SELECT ON source_table TO user;
|
|
GRANT INSERT ON source_table TO user;
|
|
GRANT SELECT ON target_table TO user;
|
|
GRANT INSERT ON target_table TO user;
|
|
"
|
|
|
|
if $CH_PATH client --user user -mn -q "INSERT INTO mv VALUES (10);"; then
|
|
exit 1
|
|
else
|
|
exit 0
|
|
fi
|
|
|
|
|
|
) |