Skip to content

Upgrade check: do not check the row policies on tables created as a table function - #127543

Open
groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:upgrade-check-skip-table-function-row-policy-tables
Open

groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:upgrade-check-skip-table-function-row-policy-tables

Conversation

@groeneai

@groeneai groeneai commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #126895

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

...

Description

Upgrade check (amd_release) gave a false Cannot check whether the row policies can be applied FAIL row on #122397 (report): Code: 636 ... The table structure cannot be extracted from a CSV format file: ... Connection refused on test_1.function_src_no_password, with the filter 1 and without it.

Root cause. 05141_create_as_external_engine_requires_select.sh leaves function_src_no_password (id UInt64) AS url('http://127.0.0.1:1/', 'CSV') in the stress database, and an interrupted 02703_row_policy_for_database.sh leaves ON test_1.* USING 1 over it. Analyzing a query over a table created AS a table function (engine Proxy) runs the function, and url() infers the schema from the source again: 10 HTTP tries, then 636, 33 s per check. 636 is neither an analysis error nor one of the table-side codes of #126895, so the policy was kept with a FAIL row.

Change. Tables with engine Proxy are not checked, like parameterized views. The error of such a table depends on the function and its source (636 here, 198 for an unknown host, 400 for a missing file), so the rule is keyed on the kind, not on a code.

A filter that only such a table rejects (a remote() one without the column) now keeps the policy instead of dropping it; reads of that table fail the same way before and after the upgrade.

Validation. Locally on 26.9.25.15 (the previous release of the check): with USING 1, a column filter or a table-level policy on the table, and with a dangling Iceberg table checked first (the CI shape), the FAIL row after 33-66 s before the change, none in under 1 s after. A broken filter next to such a table is still dropped. The cases of #126169 and #126895 give identical results (32 dropped and 20 kept for #126169's).

🤖 Generated with Claude Code


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

…able function

05141 leaves `function_src_no_password (id UInt64) AS url('http://127.0.0.1:1/', 'CSV')` in the shared
stress database, and an interrupted 02703 leaks `ON test_1.* USING 1`. Analyzing a table created as a
table function runs the function, here a schema inference from a closed port, so both probes failed with
Code 636 after 10 HTTP tries (33 s each) and the check reported a FAIL row. The code of such a failure
depends on the function and the source, so leave the table out by its kind, like a parameterized view.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=122397&sha=caab4a3f2841a606f449abcbcff809ffb6aa5161&name_0=PR&name_1=Upgrade%20check%20%28amd_release%29

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; 1 finding) plus my own cold review (0 findings).

# Sev Finding Verdict Evidence / action
1 ⚠️ No proof that the Proxy exclusion is live while an ordinary broken policy is still dropped (upgrade_runner.sh:477) DISAGREE Measured on 26.9.25.15: without the predicate the block reproduces the CI FAIL row (Code 636, 33-66 s); with it, 0 FAIL rows in under 1 s and no probe of the url() tables; a broken filter next to such a table is still dropped (Code 47 from the MergeTree table, both creation orders). No runner self-test, per #119766.

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

Session id: cron:clickhouse-review-slot-8:20261023-033600

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. 26.9.25.15 server, a database with a MergeTree table, f (id UInt64) AS url('http://127.0.0.1:1/', 'CSV') (as 05141 leaves it), a copy AS f and a dangling Iceberg table, CREATE ROW POLICY ... ON db.* USING 1 TO ALL, then the extracted row-policy block of upgrade_runner.sh: the CI FAIL row (Code 636, Connection refused, on the filtered and the bare check) on every run; the error file matches the CI one line for line.
b Root cause explained? Yes. Analyzing a query over a table created AS a table function runs the function; url() infers the schema from its source again, so each check failed with 636 after 10 HTTP tries (33 s). 636 is not one of the table-side codes, so the same failure with and without the filter still kept the policy with a FAIL row.
c Fix matches root cause? Yes. Tables with engine Proxy (created AS a table function) are left out of the checked tables, keyed on the kind like parameterized views. No code is added to the drop list or the table-side list: the error of a dead source depends on the function (636, 198, 400 measured).
d Test intent preserved / new tests added? Test infrastructure change: no self-test of the runner (per #119766). Validated locally against the 26.9.25.15 release, before and after.
e Both directions demonstrated? Yes. Same seeds: before, the FAIL row (database-level USING 1 and USING x = 1, table-level USING 1 on the table); after, 0 FAIL rows and the policies kept.
f Fix is general across code paths? Yes. url() tables with and without credentials, a copy AS <table>, database-level and table-level policies; file() and unknown-host tables are also engine Proxy. This block is the only row-policy check in the CI scripts.
g Fix generalizes across inputs (params/datatypes/wrappers)? Yes. Constant, column, broken and subquery filters; the Iceberg table checked before or after the proxies; the proxy created before or after the readable table (a broken filter is still dropped); 5,646 tables on the server.
h Backward compatible? (maintainer-approved exception only) Yes. CI script only; system.tables.engine is Proxy on the previous release (measured). Every earlier case of #126169 and #126895 gives identical results (32 dropped, 20 kept). Stated change: a filter that only such a table rejects keeps the policy.
i Invariants and contracts preserved? Yes. A policy is dropped only when its filter fails on a table that is analyzed without running a table function; fault injection (memory limit on either check, dead server, failed DROP generation) gives the same outcomes as before; the block completes under set -ex in every case.

Session id: cron:clickhouse-impl-slot-6:20261023-031100

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @yakov-olkhovskiy, could you review this and add the can be tested label so CI runs? It leaves tables created AS a table function (engine Proxy) out of the upgrade check's row-policy probe, since analyzing one runs the function and a dead url() source gave a false 636 FAIL row that the #126895 table-side codes do not cover.

@clickhouse-gh

clickhouse-gh Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f847074]

Summary: ✅


AI Review

Summary

PR #127543 excludes tables with engine Proxy from the upgrade runner's row-policy probes, avoiding schema inference against unavailable table-function sources. Reviewed commit f847074713696878508b065dabc0efc73d7e0561 and all prior discussion. No actionable findings.

Missing context / blind spots
  • ⚠️ The current CI workflow is pending, with no upgrade-check test results available. The author reports focused before/after validation on 26.9.25.15; I did not independently rerun it. A completed upgrade-check report would close the remaining CI validation gap.
Final Verdict

Status: ✅ Approve

This branch has not been deployed

No deployments
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-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants