Repository navigation
Disable every fail point a stateless test enables, and check it in style - #120809
Conversation
A fail point lives in the server process, not in the connection or the session, so one that a test enables and never disables goes on firing in whatever runs next. The stateless suite runs tests in parallel, so that is another test's query: it fails, or hangs on a pauseable fail point, for a reason that is nowhere in its own source, and the report blames the wrong change. Add the missing `SYSTEM DISABLE FAILPOINT` to the 15 tests that had none, and a `failpoints_disabled_in_tests` style sub-check that requires every `SYSTEM ENABLE FAILPOINT <name>` under `tests/queries/0_stateless` to be matched by a `SYSTEM DISABLE FAILPOINT <name>` in the same test. A `ONCE` fail point disarms itself when it fires, but nothing guarantees the test reaches the code path that consumes it - on the version the test was written against it does not fire at all - so those are disabled explicitly too. In a `.sh` test the disable goes into a `trap ... EXIT`, since an early `exit` or a failing command under `set -e` skips the rest of the file. The check leaves alone what cannot leak or is already correct: a test that arms fail points only inside `clickhouse-local`, whose process-global state dies with the process; a disable whose name comes from a shell variable, which no text check can resolve; and `EXPLAIN SYSTEM ENABLE FAILPOINT`, which prints the parsed statement and arms nothing. Asked for in #118863 (comment) Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Workflow [PR], commit [d94c1fd] Summary: ✅ AI ReviewSummaryThis PR adds explicit Findings
Final VerdictStatus: Minimum required actions:
|
| if test_case.endswith(".sh"): | ||
| # Drop comments, `echo` payloads and `clickhouse-local` invocations, so only the | ||
| # statements that reach the server are left. | ||
| content = executable_shell_content(file_content.splitlines()) |
There was a problem hiding this comment.
This new sub-check still misses one common server-query carrier: a quoted heredoc fed to clickhouse-client. executable_shell_content drops quoted heredoc bodies entirely, so a test like
$CLICKHOUSE_CLIENT <<'SQL'
SYSTEM ENABLE FAILPOINT foo;
SELECT 1;
SQLstill reaches the shared server but produces enabled = [] here. Quoted client heredocs are already common in 0_stateless, so the next failpoint test written in that form will bypass the guard and can leak a server-global fail point again.
For this check we need to keep quoted heredoc bodies when they are stdin to a server client, or use a failpoint-specific shell parser instead of reusing executable_shell_content from the server-data check.
| as well; no check here reads such a literal. | ||
| """ | ||
| text = SQL_BLOCK_COMMENT_RE.sub(" ", text) | ||
| return "\n".join(line.split("--")[0] for line in text.splitlines()) |
There was a problem hiding this comment.
# and #! are also ClickHouse SQL comments, and 0_stateless already has many .sql tests that use them. This helper only strips /* ... */ and --, so a commented-out line like # SYSTEM ENABLE FAILPOINT foo is treated as a live enable and will spuriously require a matching disable.
If this function is going to be the source of truth for failpoint scanning, it needs to discard # comments too.
alexey-milovidov
left a comment
There was a problem hiding this comment.
This is great!
The `failpoints_disabled_in_tests` check knows only `SYSTEM DISABLE FAILPOINT <name>`, so the two tests that master gained for `SYSTEM DISABLE ALL FAILPOINTS` - `05223_system_disable_all_fault_injection_points` and `05225_system_disable_all_fault_injection_points_wakes_paused` - fail it: they arm fail points and clear them with the statement that exists for exactly that. The check runs over the whole test tree, not only the changed files, so this passed on the pull request and failed in the merge queue, where the branch is tested merged with master: https://github.com/ClickHouse/ClickHouse/actions/runs/35539310363 `SYSTEM DISABLE ALL FAILPOINTS` now stands in for the per-name disables, but only in a `no-parallel` test: it is server-wide in the other direction too, and disarms what the tests running alongside armed. `SYSTEM DROP` carries the same requirement in `various_checks.sh`. A test that relies on it without the tag gets an error that says so, instead of being told to add a disable it already has. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
@alexey-milovidov — ClickGap found the following in this PR:
Close anything that's wrong or already addressed. |
…t of them The `failpoints_disabled_in_tests` style rule (from ClickHouse#120809, now on `master`) requires every `SYSTEM ENABLE FAILPOINT` in a stateless test to have a matching `SYSTEM DISABLE FAILPOINT`. Eight tests of this branch enabled `ONCE` fail points that disarm themselves after firing and never disabled them explicitly; a paused `ALTER` also stayed parked if a test exited early. The seven `.sh` tests now install a `trap cleanup EXIT` that disables every fail point they enable (a disable of an unarmed fail point is a no-op), and `05210_readonly_settings_rollback.sql` disables the throw fail point after each `ALTER` that is expected to fail. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=119559&sha=ebfc6ba3f7ab9ecf56874e4c5a7dea2a39a78297&name_0=PR&name_1=Style%20check PR: ClickHouse#119559 Co-Authored-By: Claude Fable 5.1 <[email protected]>
Related: #118863
A fail point lives in the server process, not in the connection or the session, so one that a test enables and never disables goes on firing in whatever runs next. The stateless suite runs tests in parallel, so that is another test's query: it fails, or hangs on a pauseable fail point, for a reason that is nowhere in its own source, and the report blames the wrong change.
This adds the missing
SYSTEM DISABLE FAILPOINTto the 15 stateless tests that had none, and afailpoints_disabled_in_testssub-check to the style check that requires everySYSTEM ENABLE FAILPOINT <name>undertests/queries/0_statelessto be matched by aSYSTEM DISABLE FAILPOINT <name>in the same test.A
ONCEfail point disarms itself when it fires, but nothing guarantees the test reaches the code path that consumes it - on the version the test was written against it does not fire at all - so those are disabled explicitly too. In a.shtest the disable goes into atrap ... EXIT, since an earlyexitor a failing command underset -eskips the rest of the file.The check leaves alone what cannot leak or is already correct:
clickhouse-local, whose process-global state dies with the process;EXPLAIN SYSTEM ENABLE FAILPOINT, which prints the parsed statement and arms nothing.SYSTEM DISABLE ALL FAILPOINTS, which disarms every fail point at once - credited only in ano-paralleltest, because it also disarms what the tests running alongside armed, the waySYSTEM DROPdoes invarious_checks.sh.This replaces the approach in #118863, where
clickhouse-testdisarmed the fail points a test left behind: as noted there, that cannot be made safe while tests run in parallel, because the teardown of one test would disarm a fail point another test is relying on.Tests changed:
02769,02887,02943,03100_lwu_29(both variants),03622,03753,03787,03810,04009,04024,04028,04421,04506,04652.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/120809]
Version info
26.10.1.364-master(included in26.10and later)