Repository navigation
Add create_union_system_log_tables to the default server configuration - #117943
Conversation
Enable `merge_rotated_tables` in the default `config.xml`, so that the `all_...` union tables (`system.all_query_log`, `system.all_text_log`, and so on) exist out of the box and queries over the rotated versions of a log do not have to remember constructs like `merge(system, '^query_log')`. The `cluster` setting is left as a commented-out example, because the definitions of the `all_...` tables would reference the cluster and require it to exist. Also mirror the section in `config.yaml.example` and mention the new default in the documentation of `create_union_system_log_tables`. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
|
Workflow [PR], commit [36bef85] Summary: ✅
AI ReviewSummaryI reviewed the current PR diff and all prior discussion. The PR enables Final Verdict
LLVM Coverage ReportMeasured on commit 36bef85.
Changed lines: Changed C/C++ lines covered: 46/48 (95.83%) · Uncovered code |
|
Before this becomes the default, please consider #117945: when the section is enabled, |
…g-tables-default-config
Before making `create_union_system_log_tables` a default, make the union table creation safe for a table that already occupies one of the `all_...` names: `prepareUnionTable` replaced a mismatching definition with `CREATE OR REPLACE` and both dependency checks disabled, which drops the old table together with all of its data. The names are not reserved, and a hand-made union table over the rotated logs - possibly a stateful one, such as the target of a materialized view - is exactly what users built before this feature existed. Now a table is only replaced when its stored definition is one that this feature could have generated: a stateless proxy over the `merge` or `clusterAllReplicas` table function. A table of any other shape is left intact, and a warning is written to the server log instead. The cluster-only test node turns `merge_rotated_tables` off explicitly, because the default configuration now enables it. Closes: #117945 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A table engine receives the comment from the storage factory arguments, while a table function does not receive it at all, so the comment of `CREATE TABLE t (...) AS <table function> COMMENT '...'` was written to the metadata but never shown in `system.tables`. This became visible with the `all_...` union tables of the system logs: they are proxies over the `merge`/`clusterAllReplicas` table functions and carry a comment, and `02982_comments_in_system_tables` reported all of them as having no comment once the feature is enabled by default. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
🕵 Thank you - agreed, and fixed in this pull request before the flip.
Flushing of the log table itself is unaffected. Covered by a new integration test Two other things in this update: the default flip made |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes7 object files changed (+167.30 KiB total), 0 added.
719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units10 translation units recompiled, 60 s compile time in total, 10 of them have a recent master baseline. |
…over from a name conflict `isGeneratedUnionTableDefinition` now requires, in addition to the stateless `merge`/`clusterAllReplicas` shape, the marker sentence that every union table generated by the `create_union_system_log_tables` feature carries at the end of its `COMMENT` (`It is safe to drop this table at any time: it will be recreated automatically.`). A hand-written proxy table without the marker is a user table and is preserved. A name occupied by a user table no longer sets `union_table_broken`: only `union_table_check_pending` is cleared, so the check is not repeated while the table is in place, and the union table is created at the next flush as soon as it is dropped or renamed, matching the warning and the documentation. Tests: `test_recreated_on_rotation` places a table imitating an obsolete generated one (with the marker); `test_preexisting_user_table_is_preserved` asserts the recovery at the next flush without a restart; new `test_preexisting_proxy_table_is_preserved`. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…g-tables-default-config
…g-tables-default-config
# Conflicts: # programs/server/config.xml
…_...` names in the docs Existing user tables under the `all_...` names are preserved, so the names are not reserved; describe instead which tables the feature considers its own. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 @groeneai, investigate the failures: Stress test (arm_debug) — Hung check failed (also frequent on master, possibly related to #121413) and Upgrade check (amd_release) — |
|
Both have fixing PRs. Stress test (arm_debug), Hung check failed: this is not #121413. Every hung-check connection was refused with On master, most hung checks of the past week were the Upgrade check (amd_release), |
| /// table holds no data of its own and can be replaced; a table of any other shape - a `MergeTree` | ||
| /// table or a hand-written proxy that a user happened to put on one of the `all_...` names - must | ||
| /// never be dropped automatically. | ||
| bool isGeneratedUnionTableDefinition(const ASTCreateQuery & create) |
…e log scan Stress worker 1 (`--database=test_1`) runs with `memory_tracker_fault_probability=0.05`. Work that the stress phase leaves behind keeps the settings of the query that created it and is executed again by the upgraded server after the restart: - a distributed DDL entry stores the initiator's changed settings (`DDLLogEntry`) and `DDLTaskBase::makeQueryContext` applies them, so a queued `BACKUP ... ON CLUSTER` of `test_1` replays with fault injection and `BackupsWorker` logs `Failed to make internal backup ... fault injected` at `<Error>`; - a pending `Distributed` batch is sent with its stored settings, and the receiving async-insert flush logs `AsynchronousInsertQueue: Failed insertion ... fault injected` at `<Error>` with an empty query id, so the existing `} <Error> executeQuery: Code:` entry does not cover it. Seen on three unrelated PRs in 90 days (ClickHouse#123464, ClickHouse#117943, ClickHouse#120725); in each job these lines were the only output of the scan. Nothing enables fault injection on the upgraded server itself, so the message can only come from carried-over stress work. Ignore it as a fixed string, the same string the stress smoke check already tolerates (`ci/jobs/scripts/stress/stress.py`). It is MemoryTracker's message for both injection sites and does not match a real `memory limit exceeded` error. The large DDL backlog in the ClickHouse#123464 job comes from the previous release (26.9) wedging its DDLWorker on `KILL PART_MOVE_TO_SHARD ... ON CLUSTER`, which ClickHouse#122132 fixed on master only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…base_hdfs_read_grant test_hdfs_database_cache_is_checked proved that a cached HDFS database table is served from the cache by diffing the server-wide TableFunctionExecute counter in system.events across the read. Since ClickHouse#117943 the default config.xml enables create_union_system_log_tables, so the first flush of each system log runs CREATE OR REPLACE TABLE system.all_<log> ... AS merge(...) on the SystemLog thread, and that table function also increments the global counter. On master 8a6b560 (Integration tests (amd_asan_ubsan, db disk, 4/8)) five such creations landed between the two counter reads and the test failed with `assert 6 == 1`, although the read itself was a cache hit. Read ProfileEvents['TableFunctionExecute'] of the read's own query_id from system.query_log instead, for the cache hit and for the uncached control. A cache miss executes the table function on the query's thread in DatabaseHDFS::getTableImpl, so it is attributed to the query, while background table functions are not. Validated by recreating system.all_text_log between the reads (drop it, then SYSTEM FLUSH LOGS text_log): the old test fails with `assert 2 == 1`, the new one passes; 10 fresh-cluster runs and 50 repeated runs pass; pointing the cache-hit read at an uncached name makes the new assertion fail with `assert 1 == 0`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…runs When the system log tables are prepared on startup (`prepare_system_log_tables_on_startup`, implied by `startup_scripts`), `SystemLog::prepareUnionTable` replaces an obsolete `all_...` union table with `CREATE OR REPLACE` and drops the old one before `loadMarkedAsDroppedTables` runs. The dropped table is queued with its storage and still holds its UUID, so `loadMarkedAsDroppedTables` found its metadata in `metadata_dropped` and failed the startup with `TABLE_ALREADY_EXISTS` (UUID collision). The server started on the next attempt. Union tables are created by default since ClickHouse#117943, and `all_trace_log` depends on the build id, so this happened on every upgrade of a server with `startup_scripts`. Related: ClickHouse#117943 Related: ClickHouse#112670 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Closes: #117945
Related: #112670
Related: #112653
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The
all_...union tables over the system log tables (system.all_query_log,system.all_text_log, and so on) are now created by default: the default server configuration enables thecreate_union_system_log_tablessection withmerge_rotated_tables, so queries over the rotated versions of a log no longer have to remember constructs likemerge(system, '^query_log'). Theclustersetting is shown as a commented-out example, because the table definitions would reference the cluster and require it to exist. The section is also mirrored inconfig.yaml.example, and the documentation mentions the new default.Two safety fixes make the default flip possible:
all_...names and was not created by this feature (for example, a hand-made table with data or the target of a materialized view) is never replaced: it is left intact and a warning is written to the server log. Previously the union table was created withCREATE OR REPLACEon any definition mismatch, dropping such a table together with its data.COMMENTof a table created from a table function (CREATE TABLE t (...) AS <table function> COMMENT '...') is now shown insystem.tables: it was stored in the metadata, but never applied to the storage, so all of theall_...tables appeared without a comment.Workflow [PR]
Sync PR [sync-upstream/pr/117943]
Version info
26.10.1.1458-master(included in26.10and later)