Skip to content

Host the tables of 05496_dynamic_disk_wrapper_of_server_credentials_disk in a Memory database - #131426

Merged
fm4v merged 2 commits into
ClickHouse:masterfrom
groeneai:fix-05496-stress-memory-faults
Nov 19, 2026
Merged

fm4v merged 2 commits into
ClickHouse:masterfrom
groeneai:fix-05496-stress-memory-faults

Conversation

@groeneai

@groeneai groeneai commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #130670
Related: #118681
Related: #129044
Related: #122086

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):

Not required.

Description

After #130670, Stress test jobs still fail Cannot start clickhouse-server on a table left by this test, with that fix in the build (26.8, Stress test (arm_msan)):

Code: 478. DB::Exception: Unknown storage policy `__server_test_l2h7g9r3n6j1`: Cannot parse definition from metadata file store/5fc/5fcb7a2c-5297-493a-a877-e5a11995c240/t_policy.sql. (UNKNOWN_POLICY)

Three more 26.8 jobs since 2026-11-13 left created, and #124804's run left one after an injected memory fault.

Stress worker 0 runs tests in descending order, so its global time limit stops it in the same band of newest tests every run; on 26.8 that band includes this test. The test creates tables that name disks defined inline by tables it already dropped. Such a disk stays registered while the server runs, but after prepare_for_hung_check detaches the databases and the server restarts nothing defines it, so a table left between such a CREATE and its DROP cannot be loaded.

The test now creates all its tables in a Memory database, as #122101 and #131581 do: it keeps no table metadata on disk, so after a restart it is empty wherever the test stopped. That also covers a DROP lost to a memory fault, so this PR's earlier memory_tracker_fault_probability=0 pin is removed again.

Validated locally. Killing the test before each of its client calls, then detaching and restarting: master's file leaves an unloadable table at 13 of 43 points (12 abort the start, the t_policy ones with the message above), the patched file at none of 45. 50/50 randomized runs pass; 40 runs with memory faults and 10 with the stress fuzzer profile leave nothing in the test database, and the restart succeeds.

Needs the 26.8, 26.9 and 26.10 backports, like #130670.


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

Version info

  • Merged into: 26.11.1.2807-master (included in 26.11 and later)
  • Backported to: 26.10.8.36, 26.9.34.17, 26.8.42.14

…er_credentials_disk

Stress workers with `i % 5 == 1` run every test with
`memory_tracker_fault_probability=0.05`. The setting also applies to the
client's own query memory tracker, so a `clickhouse client` call can fail
with `Code: 241 ... fault injected` before it sends its query. When that
call is the cleanup `DROP` of the last `run()` or of `t_policy`, a table
that names the dynamic disk `plain_<db>` (or the policy `__server_<db>`)
survives the test. Nothing defines that disk after a restart, so the
server cannot load the table and does not start (`Code: 479 Unknown disk
plain_test_1`, seen on ClickHouse#124804 with ClickHouse#130670 already in the build).

Pin the probability to 0 for this test, next to the fuzzer and ignored
DROP pins added by ClickHouse#130670.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 0 findings), plus my own cold review of the diff (0 blockers, 0 majors).

I traced every ${CLICKHOUSE_CLIENT} call of the test (each run() statement and its DROP, DROP TABLE t_policy) through tests/clickhouse-test (--allow_repeated_settings, so the test's later value wins) and configureMemoryTrackerFromSettings (a fault probability is set only when it is above 0, in the client's own query scope and on the server). I also checked the other stress client options of ci/jobs/scripts/stress/stress.py: none of them can fail a CREATE or DROP of this test.

Severity: ❌ blocker / ⚠️ major / 💡 nit. No findings to adjudicate.

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. Local debug server with the CI config; the unpatched test runs in test_1 with --client-option memory_tracker_fault_probability=0.05, until a run leaves a table (2 of 20 runs, then 1 of 3). A restart with async_load_databases = false then fails with Code: 479 Unknown disk plain_test_1 ... ENGINE = Log SETTINGS disk = 'plain_test_1', the CI error. At probability 1 the client fails before it sends the query (0 rows in the server's query_log).
b Root cause explained? Stress workers with i % 5 == 1 pass memory_tracker_fault_probability=0.05; it also applies to the client's own query memory tracker, so a client call can fail before it sends its query. A lost cleanup DROP after the last run(), or of t_policy, leaves a table that names a disk or policy that existed only in the server's memory, and the restarted server cannot load it.
c Fix matches root cause? Yes. The test's client pins --memory_tracker_fault_probability=0, next to the two pins from #130670, so injection cannot fail the test's own CREATEs and DROPs. No assertion, query, reference or tag change.
d Test intent preserved / new tests added? Preserved: every query and the .reference are unchanged. No new test: the signal is the stress restart, which a stateless test cannot assert.
e Both directions demonstrated? Yes, same binary, only the test file differs. Unpatched: 2/20 runs leave a table and the restart fails. Patched: 20/20 pass, 0 faults, 0 leftovers, the restart succeeds; on the same server the unpatched file still gets faults in 2 of 3 runs. Stress fuzzer profile with worker 1's full option string: 10/10, 0 tables left, the restart succeeds. 50/50 randomized runs pass.
f Fix is general across code paths? Every client call of the test (each run() statement and its DROP, DROP TABLE t_policy, and the final DROP line #118681 adds) goes through the one redefinition. The keeper client creates no tables.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (test-only). Checked with both stress profiles: the plain one with the fault options and the fuzzer one with worker 1's full option string.
h Backward compatible? (maintainer-approved exception only) Yes, test-only. Needs the same backports as #130670 (26.8, 26.9, 26.10).
i Invariants and contracts preserved? The test's own invariant, that no table it creates outlives it, now holds under worker 1's options. The pinned value wins over the stress client option (--allow_repeated_settings, last value wins; getSetting returns 0).

Session id: cron:clickhouse-impl-slot-40:20261113-194100

@clickhouse-gh

clickhouse-gh Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [233ab11]

Summary: ✅


AI Review

Summary

Moves the tables in 05496_dynamic_disk_wrapper_of_server_credentials_disk.sh into a Memory database so interrupted runs and failed cleanup cannot leave persistent table definitions that prevent the stress-test server from restarting. No actionable findings in head 233ab119ef373c1ced766b58037919f716510978. The reported interruption/restart validation provides focused evidence for this CI fix, and the existing assertions remain intact.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-ci can be tested Allows running workflows for external contributors comp-testing Test content only (no production code). labels Nov 13, 2026
…isk in a Memory database

The stress test stops every worker at its global time limit. Worker 0
runs the tests in the runner's default descending order, so the limit
lands in the same band of newest tests on every run; on 26.8 that band
includes 05496 (4 `Stress test` jobs in 4 days, with ClickHouse#130670 present).
The test can then stop between a `CREATE TABLE` that names a disk of an
already dropped table (`disk = '<name>'`, `storage_policy =
'__<name>'`, a wrapper of `server_<db>`) and its `DROP`.
`prepare_for_hung_check` detaches, not drops, the databases, the restart
attaches them again, the table cannot be loaded (`Unknown storage policy
__server_<db>`, `Unknown disk plain_<db>`, `The wrapped disk must have
been announced earlier`) and the server does not start.

An interruption cannot be pinned by a setting, so every table of the
test now lives in a Memory database, which keeps no table metadata on
disk: after the restart it is empty, wherever the test was stopped. That
also covers a `DROP` lost to an injected memory fault, so the
`memory_tracker_fault_probability=0` pin of the previous commit is
removed again. Same shape as ClickHouse#122101 (05234) and ClickHouse#131581 (05620).

`CREATE DATABASE ... ENGINE = Memory` stays on one line: the runner's
`--replace-log-memory-with-mergetree` (stress worker 0) rewrites
`ENGINE = Memory` to MergeTree except on a line with `CREATE DATABASE`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai changed the title Keep injected memory faults out of 05496_dynamic_disk_wrapper_of_server_credentials_disk Host the tables of 05496_dynamic_disk_wrapper_of_server_credentials_disk in a Memory database Nov 17, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review of the new commit by an independent model (engine: codex; 0 findings), plus my own cold review of the diff (0 findings).

I checked that every later client call of the test goes through the switched --database, that --replace-log-memory-with-mergetree leaves the CREATE DATABASE ... ENGINE = Memory line alone, that the runner's leftover-table check still sees an empty test database, and that the 05496 hunks of #118681 and #96130 still apply.

Session id: cron:clickhouse-review-slot-9:20261117-102800

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. A client wrapper kills the test's process group before its N-th client call; then every database is detached as prepare_for_hung_check does and the server restarts with async_load_databases = false. With master's file and N = the DROP TABLE t_policy call, the start fails every time with Code: 478 ... Unknown storage policy __server_<db> ... t_policy.sql (UNKNOWN_POLICY), the CI message.
b Root cause explained? Stress worker 0 runs tests in descending order, so its global time limit stops it in the same band of newest tests; on 26.8 that includes 05496. The test creates tables naming disks defined inline by tables it already dropped. The disk lives only in the running server, so a table left between such a CREATE and its DROP cannot be loaded after the restart.
c Fix matches root cause? Yes. The tables live in a Memory database, which writes no table metadata, so a restart loads none of them, wherever the test stopped. It replaces this PR's earlier memory-fault pin, which a lost DROP no longer needs.
d Test intent preserved / new tests added? Preserved: every query and the .reference are unchanged (50/50 randomized runs). No new test: the signal is the stress restart.
e Both directions demonstrated? Yes, same binary, only the test file differs. Kill at each client call: master's file leaves an unloadable table at 13 of 43 points, the patched file at 0 of 45 (all 89 databases reload, sync and async). Negative control: with the --database substitution broken, the patched file fails like master.
f Fix is general across code paths? Every CREATE TABLE of the test (the run() calls, t_policy, the engine cases) runs through the switched client: in query_log, 19 of 19 run in <db>_1, 0 in <db>.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (test-only). Checked under the stress profiles: memory faults (40 runs, 50 lost DROPs, 0 tables in <db>), the stress fuzzer profile with worker 1's options (10/10), and --replace-log-memory-with-mergetree (keeps ENGINE = Memory; its 2 Log-line diffs are the same on master's file).
h Backward compatible? (maintainer-approved exception only) Yes, test-only. Needs the 26.8, 26.9 and 26.10 backports, like #130670.
i Invariants and contracts preserved? The test's main database stays empty (the runner's leftover check passes), its disk and Keeper names still derive from <db>, and no table it creates is ever persisted where a restart loads it: after every kill point and restart, 0 failed loads.

Session id: cron:clickhouse-impl-slot-5:20261117-094600

@fm4v
fm4v added this pull request to the merge queue Nov 18, 2026
Merged via the queue into ClickHouse:master with commit bc6d347 Nov 19, 2026
192 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 19, 2026
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Nov 20, 2026
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Nov 20, 2026
clickhouse-gh Bot added a commit that referenced this pull request Nov 20, 2026
Backport #131426 to 26.10: Host the tables of 05496_dynamic_disk_wrapper_of_server_credentials_disk in a Memory database
clickhouse-gh Bot added a commit that referenced this pull request Nov 20, 2026
Backport #131426 to 26.9: Host the tables of 05496_dynamic_disk_wrapper_of_server_credentials_disk in a Memory database
clickhouse-gh Bot added a commit that referenced this pull request Nov 20, 2026
Backport #131426 to 26.8: Host the tables of 05496_dynamic_disk_wrapper_of_server_credentials_disk in a Memory database
@clickhouse-gh clickhouse-gh Bot added comp-disk-abstractions Core disk abstractions: IDisk interface, DiskLocal, storage policies, volumes, disk management to... 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

can be tested Allows running workflows for external contributors comp-disk-abstractions Core disk abstractions: IDisk interface, DiskLocal, storage policies, volumes, disk management to... pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-ci pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo v26.8-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants