Files
datastore/utils/auto-bisect/tests/test_insert_ttl_dict_privilege.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

35 lines
984 B
Bash
Executable File

#!/bin/bash
set -e
CH_PATH=${CH_PATH:=clickhouse}
(
$CH_PATH client -mn -q "
DROP TABLE IF EXISTS ttl_dict;
DROP DICTIONARY IF EXISTS always_alive_ids_dict;
DROP TABLE IF EXISTS always_alive_ids;
CREATE TABLE always_alive_ids (id UInt64) engine=Memory();
INSERT INTO always_alive_ids VALUES (-1);
CREATE DICTIONARY always_alive_ids_dict (id UInt64) PRIMARY KEY id SOURCE(CLICKHOUSE(TABLE 'always_alive_ids')) LAYOUT(HASHED()) LIFETIME(0);
CREATE TABLE ttl_dict (id UInt64, event_date Date) ENGINE = MergeTree ORDER BY (id) TTL event_date + INTERVAL 1 MONTH WHERE NOT dictHas('always_alive_ids_dict', id);
INSERT INTO ttl_dict SETTINGS log_comment='x' VALUES (1, today()-60)(2, today()-60)(3, today()) ;
system flush logs;
"
result=$($CH_PATH client -mn -q "
SELECT has(used_privileges, 'dictGet ON default.always_alive_ids_dict')
FROM system.query_log
WHERE log_comment = 'x' AND type != 'QueryStart';")
echo $result
if [ "$result" = "1" ]; then
exit 1
else
exit 0
fi
)