Repository navigation
Conversation
createTableFromAST threw a LOGICAL_ERROR (Invalid storage definition in metadata file) when a table had no column list and no storage engine. That premise is false for views: an ordinary view has no engine by design and its column list may legitimately be absent (StorageFactory forbids an engine on views and StorageView handles empty columns). Previously only parameterized views were exempt (see ClickHouse#60708), so any other columnless view in on-disk metadata (as produced by the AST fuzzer or manual intervention) aborted the whole server on startup during async table loading. Exempt all views from the throw. A columnless view now fails to load with a normal catchable EMPTY_LIST_OF_COLUMNS_PASSED exception instead of killing the server. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-5:20260717-173001 |
|
cc @tavplubix @KochetovNicolai — could you review this? It stops the server aborting on startup ( |
|
Workflow [PR], commit [258d7fb] Summary: ❌
AI ReviewSummaryThis PR fixes the real product bug in Findings
Final VerdictChanges requested. The product-side fix looks correct, but the test needs to be isolated rather than carving out a new exception to the shared-server metadata-mutation guard. LLVM Coverage ReportMeasured on commit 258d7fb.
Changed lines: Changed C/C++ lines covered: 2/6 (33.33%) · Uncovered code |
Under the CI "db disk" config (--remote-database-disk) the database metadata lives on a remote object-storage disk, so the test's local filesystem perl edit of v.sql could not find the file: it emitted stderr and skipped the column strip, so EMPTY_LIST_OF_COLUMNS_PASSED was never produced and the test failed. Make the metadata edit disk-agnostic like 03001_matview_columns_after_modify_query: edit locally when the file is on the local FS, otherwise read/transform/write via clickhouse-disks against a bundled disk config and drop the plain_rewritable metadata cache. The source fix is unchanged. Co-Authored-By: Claude Opus 4.8 <[email protected]>
grep -o | head -n1 always exits 0 (head is the terminal command), so the assertion could pass even if the marker never appeared. Make grep the terminal command with -m1; stdout is byte-identical, exit code now reflects whether EMPTY_LIST_OF_COLUMNS_PASSED was actually produced. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Applied in 4b7e189: made |
After the expected ATTACH DATABASE failure (EMPTY_LIST_OF_COLUMNS_PASSED), the database is detached but its on-disk metadata file is not dropped, so a plain DROP DATABASE IF EXISTS is a no-op and leaves the metadata behind. A rerun on the same server would then fail at CREATE DATABASE with ATOMIC_RENAME_FAIL because the metadata file already exists. Restore the original valid metadata, re-attach, and DROP DATABASE ... SYNC so cleanup is unconditional and idempotent. Keep the original metadata in a variable rather than a sidecar file (an extra file in the store dir makes ATTACH fail with INCORRECT_FILE_NAME). Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Confirmed and fixed in 0603b03. Reproduced the mechanism locally: after the expected Fix: keep the original valid metadata in a variable, restore it, Verified: running the test twice on one server with a fixed db name fails at run 2 on the old version and passes on the new one; stdout is unchanged; 50/50 with randomization pass. |
CI finish ledger — 0603b03
Our regression test |
CI finish ledger — 0603b03CI fully finished on this head (Finish Workflow / Config Workflow / Mergeable Check all green). Every failure below has an owner.
The earlier PR-caused failure ( Session id: cron:our-pr-ci-monitor:20260718-143000 |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 2/6 (33.33%) · Uncovered code |
CI finish ledger - d9223e8CI is fully finished on this head with no failing checks, so there is nothing to Session id: cron:our-pr-ci-monitor:20260729-083000 |
…er-abort Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ation check Public master gained `server_data_manipulation_in_stateless_tests` after this branch was cut, and it flags this test: it reads `metadata_path` from `system.tables` and then writes that file. The heuristic is right about the shape but wrong about the risk here - the test edits only the metadata of the view it created itself. A view has no data parts, so none of the part-directory or blob reference-counting hazards the check guards against apply. On a remote database disk the edit goes through `clickhouse-disks` rather than a raw copy, the metadata cache is dropped so the edit is visible, the original definition is restored at the end, and the test is already tagged `no-replicated-database` and `no-shared-catalog`. Without this the check fails both here and in the private sync once master is merged, which is what surfaced it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
| # apply. On a remote database disk it goes through `clickhouse-disks` rather than a raw copy, | ||
| # drops the metadata cache afterwards, restores the original definition, and the test is tagged | ||
| # no-replicated-database / no-shared-catalog. | ||
| "04603_columnless_view_metadata_no_server_abort.sh", |
There was a problem hiding this comment.
This is not a false positive under the new server_data_manipulation_in_stateless_tests contract: the new regression test reads system.tables.metadata_path / the server root, rewrites live database metadata (including via clickhouse-disks write), and then relies on no-parallel because it is mutating shared server state. Exempting it here weakens the guard instead of fixing the portability problem.
We already cover the same metadata-reload family safely with clickhouse-local --path scratch directories in 04651_parameterized_view_union_child_metadata.sh. Please use the same pattern here, or move this scenario to an integration test, so a failing run cannot leave corrupted metadata behind on the shared server.
There was a problem hiding this comment.
Agreed with the commit message that the heuristic is right about the shape: the test does read metadata_path from system.tables and then rewrite that file.
What I can add is a measurement. The scenario does not need the shared server at all. A clickhouse-local --path scratch directory reaches the same load path:
- Unfixed master binary, column list stripped from the view metadata inside the test's own temp dir:
Logical error: 'Invalid storage definition in metadata file', signal 6, atDatabaseOnDisk.cpp:145increateTableFromAST, called fromloadTableFromMetadataandloadTableFromMetadataAsync. Same frames as the stress-test abort this PR fixes. - Same steps on this branch: no abort,
Code: 90 ... (EMPTY_LIST_OF_COLUMNS_PASSED). - Control with the metadata left alone: loads and queries normally.
One thing that form gives up: clickhouse-local waits on every load job, so any query after the bad load returns ASYNC_LOAD_WAIT_FAILED wrapping the same exception. So it proves the abort becomes a catchable exception, but not "the server stays up and keeps serving other tables", which is what the current ATTACH DATABASE shape asserts. Keeping that assertion needs a real server, so an integration test.
The --path form also drops the exclusion entry, the clickhouse-disks branch, 04603_columnless_view_metadata_no_server_abort.xml, the metadata cache drop, the restore-and-reattach cleanup, and all four tags. I have it written and green in both directions locally.
I have not pushed anything, since the head is yours. I can send it if you want it.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 10 s compile time in total, 7 of them have a recent master baseline. |
|
📊 Cloud Performance Report ✅ AI verdict: no significant changes detected. K_source=6 K_base=30 flagged=0/65 clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
CI finish ledger - 8681fa2Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
This PR cannot reach any of them: the diff is 5 files, On the I have not merged master to pick up Session id: cron:our-pr-ci-monitor:20260830-040000 |
CI finish ledger - 258d7fbEvery failure below has an owner: a fixing PR, or a full-effort fix task whose fixing-PR link
The two Attribution, read from master rather than inferred from the pull request title. The exception text and This test is built to sit in that window: it sets A slow sanitizer host genuinely exceeding the two second budget remains the alternative reading, and Session id: cron:our-pr-ci-monitor:20260831-063000 |
tavplubix
left a comment
There was a problem hiding this comment.
Such a view now fails to load with a normal exception instead of terminating the whole server.
Don't the server fail to start anyway if it fails to load a table/view?
and its stored column list may legitimately be absent
Why? Is it actually legit?
|
Both fair. Measured on a real server rather than argued from the loader. "Don't the server fail to start anyway if it fails to load a table/view?" Not with the default
With The difference is therefore confined to servers where That it is the error class and not the failed load: on unfixed master the same missing-column-list condition on a non-view table ( The sentence you quoted was too broad. I have narrowed the changelog and description to that scope. "Is it actually legit?" For parameterized views yes, which is why the first exemption exists: For a view not recognized as parameterized on reload I cannot exhibit a supported producer. On master: plain So "legitimately absent" is wrong. I replaced it with what I can back: corrupted or externally modified metadata should not abort the server. The code comment needs the same correction. One gap, stated plainly: I have not root-caused how the fuzzer's copy of a parameterized view ends up with no column list while no longer satisfying |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Loading a
VIEWwhose stored metadata has no column list no longer raisesLOGICAL_ERROR: Invalid storage definition in metadata file, which aborts the process on a server where a logical error is fatal (debug and sanitizer builds, orabort_on_logical_error = 1). Such metadata now fails to load with a catchableEMPTY_LIST_OF_COLUMNS_PASSEDexception.Description
Related: #60708
createTableFromAST(src/Databases/DatabaseOnDisk.cpp) raisedLOGICAL_ERRORwhenever a table had no column list and no storage engine. An ordinary view never has a storage engine (StorageFactoryforbids one), so for views that guard reduces to "no column list impliesLOGICAL_ERROR", while every other columnless case takes the ordinaryEMPTY_LIST_OF_COLUMNS_PASSEDbranch beside it. Only parameterized views were exempted (#60708); those are stored without a column list by design. Corrupted or externally modified view metadata that is no longer recognized as parameterized hit the throw during async table loading.The fix skips the throw for all views, so such metadata fails to load with a catchable exception.
Measured on a real server: columnless view metadata, plus a normal table, plus a restart.
abort_on_logical_error = 1(whattests/config/install.shinstalls for every functional and stress server except Fast test): before,Received signal 6inside the async loader and the server never accepts a connection, so no table is reachable. After, the server starts, serves every other table, and reading the view returnsEMPTY_LIST_OF_COLUMNS_PASSED.async_load_databases = 0: startup fails either way.Found by Stress test (amd_asan_ubsan), which aborted on every restart while loading the fuzzer-created parameterized view
test_5.prewhere_bug_view__fuzz_4(from04227_prewhere_parameterized_view_join_102074.sql). The same signature reached the 26.7 release branch on 2026-08-29 withtest_3.date32_pv__fuzz_4.Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=107091&sha=5e31ccb31390e87186ca0a7a5a047aec6968c392&name_0=PR&name_1=Stress%20test%20%28amd_asan_ubsan%29
Stack from that report:
Workflow [PR]
Sync PR [sync-upstream/pr/110906]