Skip to content

Do not load other tests' lazy tables in 00076_system_columns_bytes - #122532

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix/00076-exclude-lazy-tables-and-aliases
Sep 27, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix/00076-exclude-lazy-tables-and-aliases

Conversation

@groeneai

@groeneai groeneai commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #121703

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

The test 00076_system_columns_bytes no longer reads the column sizes of TableProxy and Alias tables, so its server-wide read no longer loads lazily loaded tables that concurrent tests expect to be still unloaded.

Description

05153_alias_truncate_lock failed its lazy-target precondition while every arm matched: job, report (mt_i/rmt_j read MergeTree/ReplicatedMergeTree instead of TableProxy). The job's server log shows the concurrent 00076 query loading both tables after the test's ATTACH DATABASE and before its check read them. It is 1 red in about 3,000 runs since #121703 added the check.

00076 sums the column sizes of every table on the server. Reading the sizes of a table in a lazy_load_tables database that is not loaded yet (engine TableProxy) loads it, and an Alias reads the sizes of its target. 05153's aliases are reached before its lazy database, and the log's load order (mt_i, rmt_j, log_k) is the alias one.

I exclude TableProxy and Alias in the test's system.tables subquery, next to its Merge/Proxy exclusions. The IN set filters the tables before any size is read, so nothing is loaded. An Alias has no data of its own, and an already loaded lazy table is still summed. Fixing 00076 rather than 05153 also covers the five other parallel tests that check TableProxy after re-attaching a lazy database; 00076 is the only parallel test that reads sizes server-wide.

Validation, 05153 under a background loop issuing 00076's query: 14/30 runs failed with the old query, 11/30 with only TableProxy excluded, 0/30 with this change (a loader query started inside the vulnerable window in 22 of the 30). Injecting the query right after 05153 creates its aliases fails it 3/3 with the old query or either exclusion alone, and passes 3/3 with both. 00076 passes 50/50 randomized runs.

The open #113389 makes these reads stop loading unloaded tables; once it is merged, this exclusion is no longer needed.


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

Version info

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

05153_alias_truncate_lock failed in
https://github.com/ClickHouse/ClickHouse/actions/runs/36297932393/job/108585515908
because its lazy targets were already loaded when it checked them: the
server log shows the concurrent 00076 query ab529e2a loading mt_i and
rmt_j through 05153's Alias tables between its ATTACH DATABASE and the
check.

00076 reads the column sizes of every table on the server. Excluding the
TableProxy and Alias engines in its system.tables subquery prevents the
load instead of hiding the rows: the IN set filters the tables before
any size is read. A TableProxy is a table of a lazy_load_tables database
that nothing has read yet, and reading its sizes loads it; an Alias
forwards the size read to its target, which can be such a table.

With a concurrent loop issuing 00076's query, 05153 failed 14 of 30 runs
with the old query, 11 of 30 when only TableProxy is excluded, and 0 of
30 with this change.

Related: ClickHouse#121703

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding labels Sep 27, 2026
@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; 1 finding) and my own review (1 finding).

# Sev Finding Verdict Evidence / action
1 ⚠️ 00076 still prints 1 1 1 if either exclusion is reverted, so no in-tree test fails deterministically DISAGREE Live by deletion: with 00076's query injected into 05153, dropping TableProxy or Alias fails it 3/3, the full list passes 3/3 (concurrent loop: 14/30, 11/30 vs 0/30); the six parallel TableProxy checks are the in-tree observers. A deterministic guard needs a lazy fixture inside 00076 that its parallel flaky-check copies could race; the earlier Merge/Proxy exclusions also shipped predicate-only.
2 💡 The TableProxy note says "nothing has read yet", but any first access (insert, size or path read) loads the table AGREE, noted Wording only; the description uses "not loaded yet".

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per finding.

Session id: cron:clickhouse-review-slot-11:20260927-130114

@clickhouse-gh

clickhouse-gh Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [3fdeff9]

Summary: ✅


AI Review

Summary

This PR narrows 00076_system_columns_bytes so its server-wide system.columns read no longer materializes lazy tables through TableProxy and Alias, which matches the race described in the PR. The predicate itself looks directionally right, but the change still lacks an in-tree regression that proves the contract and fails deterministically if either exclusion is removed.

Findings

⚠️ Majors

  • [tests/queries/0_stateless/00076_system_columns_bytes.sql:18] The PR promises that 00076 no longer loads lazy alias targets, but the repository still does not assert that behavior anywhere. 00076 still only checks 1 1 1, and the existing lazy-table tests inspect TableProxy in separate fixtures without ever running this size query. That means removing either TableProxy or Alias from this filter would reintroduce the race with no deterministic in-tree failure, leaving CI to rediscover it probabilistically.
    Suggested fix: add a focused .sh regression test that creates a lazy_load_tables database plus an Alias to an unloaded target, runs the same system.columns size query, and then asserts the target is still reported as TableProxy.
Tests
  • ⚠️ Add the focused lazy-load regression above; it is the smallest proof that this filter really prevents system.columns from materializing the alias target, and it would fail immediately if either exclusion is removed.
Final Verdict
  • Status: ⚠️ Request changes
  • Add a deterministic regression test for the lazy TableProxy/Alias interaction. The query change looks plausible, but right now the protection against regression lives only in manual stress evidence and probabilistic parallel CI.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Sep 27, 2026
@groeneai
groeneai requested a review from nauu September 27, 2026 13:44
`table`
FROM system.tables
WHERE engine != 'Merge' AND (engine != 'Proxy' OR create_table_query NOT ILIKE '%merge%')
WHERE engine != 'Merge' AND (engine != 'Proxy' OR create_table_query NOT ILIKE '%merge%') AND engine NOT IN ('TableProxy', 'Alias')

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.

The predicate change makes sense, but the PR still does not prove the behavior it is relying on. 00076 still only checks 1 1 1, and none of the lazy-load tests runs this size query and then asserts that the target stays TableProxy. If someone later drops either TableProxy or Alias from this filter, the regression only comes back as a probabilistic parallel CI flake.

Please add a small focused .sh regression test that creates a lazy_load_tables database plus an Alias to an unloaded target, runs the same system.columns size query, and then checks that system.tables still reports the target as TableProxy.

@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Sep 27, 2026
@alexey-milovidov alexey-milovidov self-assigned this Sep 27, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Sep 27, 2026
Merged via the queue into ClickHouse:master with commit 65cb022 Sep 27, 2026
172 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 27, 2026
@clickhouse-gh clickhouse-gh Bot added comp-system-table system.* tables (introspection, system metadata, performance visibility). 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-system-table system.* tables (introspection, system metadata, performance visibility). groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding 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.

3 participants