Skip to content

Keep SQLite pushdown test cleanup safe under fuzzing - #124548

Merged
github-merge-queue[bot] merged 1 commit into
ClickHouse:masterfrom
qoega:codex/sqlite-fuzz-cleanup
Oct 12, 2026
Merged

github-merge-queue[bot] merged 1 commit into
ClickHouse:masterfrom
qoega:codex/sqlite-fuzz-cleanup

Conversation

@qoega

@qoega qoega commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

The S3 ARM ASan/UBSan stress job could no longer restart the server after the SQLite pushdown test: fuzzed MergeTree tables retained CHECK subqueries referencing the SQLite table after its backing directory had been removed.

Keep this test's CREATE and DROP queries deterministic, force its cleanup drops to execute even when stress testing randomly ignores drops, and retain the SQLite files if either cleanup drop fails. Query fuzzing stays enabled.

Validated on dev with the ARM64 CI binary: the existing functional reference matched, query fuzzing with ast_fuzzer_runs=5, ast_fuzzer_any_query=1, and ignore_drop_queries_probability=1 left no attached/detached tables or SQLite directory, and the server restarted successfully.

Related: #124490
Related: #123843

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=124490&sha=556553a5d64f1b467909bcfa9b982188ca3c6cbb&name_0=PR&name_1=Stress%20test%20%28arm_asan_ubsan%2C%20s3%29

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Keep the SQLite pushdown test's cleanup safe under AST fuzzing and randomly ignored drops.


Workflow [PR]
Sync PR [sync-upstream/pr/124548]

Version info

  • Merged into: 26.10.1.1-master (included in 26.10 and later)

Disable DDL mutation for tables tied to the test's SQLite file and
force cleanup drops to execute. Keep the backing file if a drop fails,
while retaining query fuzzing.

Validated the existing reference, query fuzzing with randomly ignored
drops, and a server restart using the ARM64 CI binary.

Related: ClickHouse#124490
CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=124490&sha=556553a5d64f1b467909bcfa9b982188ca3c6cbb&name_0=PR&name_1=Stress%20test%20%28arm_asan_ubsan%2C%20s3%29
@clickhouse-gh

clickhouse-gh Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [88aa0d8]

Summary: ✅


AI Review

Summary

This PR hardens 05321_sqlite_pushdown_enum_constant.sh against AST-fuzzer DDL rewrites and ignored DROPs by pinning the DDL queries to deterministic settings and by keeping the SQLite files around when cleanup fails. That direction makes sense, but the current EXIT-trap cleanup still swallows real DROP failures, so the test can report success while leaving the leaked tables/directories that the PR is trying to surface.

Missing context / blind spots
  • ⚠️ The exact ARM S3 ASan/UBSan stress reproducer from the linked report is still pending on this PR, so I could only validate the shell semantics and the changed test logic locally.
Findings
⚠️ Majors
  • [tests/queries/0_stateless/05321_sqlite_pushdown_enum_constant.sh:20] trap cleanup EXIT does not propagate a non-zero return from cleanup into the script exit status. With the new || return branches, a real DROP failure only skips rm -rf "${BASE}"; the test still exits successfully and silently leaves t_05321* behind, hiding exactly the cleanup leak this PR is supposed to catch. Suggested fix: record failures in a flag, attempt both drops unconditionally, skip removing ${BASE} if any drop failed, and then make the trap path exit 1 (or call cleanup explicitly before normal exit) so CI still fails on leaked objects.
Final Verdict

Request changes: the deterministic DDL part looks right, but the cleanup error path still needs to fail the test instead of silently succeeding.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Oct 8, 2026
Comment on lines +20 to +21
${CLICKHOUSE_CLIENT} --ast_fuzzer_any_query=0 --ignore_drop_queries_probability=0 --query "DROP TABLE IF EXISTS t_05321_check" || return
${CLICKHOUSE_CLIENT} --ast_fuzzer_any_query=0 --ignore_drop_queries_probability=0 --query "DROP TABLE IF EXISTS t_05321" || return

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trap cleanup EXIT does not propagate a non-zero return from cleanup into the script's exit status here. In bash these || return branches only skip rm -rf "${BASE}"; a real DROP failure still lets the test exit 0 and silently leaves t_05321* behind, which hides exactly the cleanup leak this PR is trying to surface.

Please track failure in a flag, attempt both drops unconditionally, skip deleting ${BASE} if any drop failed, and then make the trap path exit 1 (or call cleanup explicitly before normal exit) so CI still fails on leaked objects.

@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Oct 8, 2026
@github-merge-queue
github-merge-queue Bot merged commit c530447 into ClickHouse:master Oct 12, 2026
151 of 152 checks passed
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 12, 2026
alexey-milovidov pushed a commit to amosbird/ClickHouse that referenced this pull request Oct 26, 2026
`Stress test (amd_tsan)` on ClickHouse#79412 failed with `Cannot start clickhouse-server`:
the restart could not load `test_7.in_subquery_ttl__fuzz_2`, a server-side AST
fuzzer copy of the test's `TTL ... WHERE x IN (SELECT x FROM in_subquery_dist)`
table, because `in_subquery_source` behind the `Distributed` table had been
dropped (`Code: 60 ... Unknown table expression identifier`).

Stress runs the test in the shared database `test_7`, which is loaded again on
restart. The fuzzer copy is never dropped by the test and keeps
`in_subquery_dist` alive, while `DROP TABLE in_subquery_source` succeeds. An
ignored `DROP` (`ignore_drop_queries_probability = 0.2`) of `in_subquery_ttl`
and `in_subquery_dist` leaves the original table in the same state; the
fuzzer's own internal `DROP` replays mostly hide that path today, so pinning
only the fuzzer would expose it.

Set `ast_fuzzer_any_query = 0` and `ignore_drop_queries_probability = 0` at the
top of the file, as ClickHouse#124548 did for 05321. `SELECT`s are still fuzzed.

The leading `DROP TABLE IF EXISTS` lines now also drop dependents first, like
the cleanup at the end: an in-place retry of a run that failed before its
cleanup otherwise drops `in_subquery_source`, then stops on `in_subquery_dist`,
which the leftover `in_subquery_ttl` depends on, and leaves the same unloadable
table.

Validated on a master debug build with restarts under
`async_load_databases = false`: a surviving fuzzer copy, and the original
table with only the fuzzer pin, both fail with the CI error, and so does a
retry of the previous version of the file over a run cut before its cleanup
(it stops with `HAVE_DEPENDENT_OBJECTS` on `in_subquery_dist`). With the
change, 30 runs with the fuzzer on and every `DROP` ignored leave no tables, a
run cut before the cleanup restarts cleanly, a retry over it drops every table,
and 50/50 randomized runs pass.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=79412&sha=fabad86e8e451c8e584218575118d6b2c258191d&name_0=PR&name_1=Stress%20test%20%28amd_tsan%29
Failing job: https://github.com/ClickHouse/ClickHouse/actions/runs/39813182646/job/120003879638
PR: ClickHouse#79412

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added comp-foreign-db Connectivity to external databases (ODBC/JDBC, MySQL, PostgreSQL, etc.). and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-foreign-db Connectivity to external databases (ODBC/JDBC, MySQL, PostgreSQL, etc.). pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants