Skip to content

Antalya 26.6 Backport of #123436 - 26.8: Fix ALIAS row policies on legacy distributed reads - #2655

Merged
zvonand merged 2 commits into
antalya-26.6from
backports/antalya-26.6/123436
Oct 24, 2026
Merged

zvonand merged 2 commits into
antalya-26.6from
backports/antalya-26.6/123436

Conversation

@zvonand

@zvonand zvonand commented Oct 23, 2026

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Fix a bug where using aliases and row policies with enable_analyzer=0 could error out (ClickHouse#123436 by @mkmkme)

Documentation entry for user-facing changes

...

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Unit tests
  • Performance tests
  • Aarch64 tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • CAS (content-addressed storage; Antalya only)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

clickhouse-gh Bot and others added 2 commits October 23, 2026 15:08
…-distributed-26.8

26.8: Fix `ALIAS` row policies on legacy distributed reads

Conflicts committed as-is; the next commit resolves them:
- src/Interpreters/InterpreterSelectQuery.cpp (both modified)
antalya-26.6 has no `shouldPushRowLevelFilterToStorage()` or subcolumn PREWHERE support, so I kept only the `include_row_level_filter` part of the PR in the conflicted lines.
@zvonand

zvonand commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

Backporter: cherry-pick conflicts resolved by AI

Conflicted files:

  • src/Interpreters/InterpreterSelectQuery.cpp (both modified)

Commits:

  • 5b74cf9: cherry-pick with the conflicts committed as-is

  • 2ffbf8f: resolution

  • First conflict, the row-level filter condition in get_prewhere_columns: upstream changed row_level_filter && shouldPushRowLevelFilterToStorage(), but antalya-26.6 only has if (row_level_filter). I used if (row_level_filter && include_row_level_filter) and dropped the upstream comment about filters not pushed to storage, since that mechanism isn't on this branch.

  • Second conflict, the supported-PREWHERE-columns check: upstream's context lines declare table_columns and include_subcolumns for subcolumn handling, which doesn't exist here. I kept the antalya-26.6 code and only changed the call to get_prewhere_columns(/*include_row_level_filter=*/ true).

  • Result: the row-policy columns are left out of the PREWHERE set when building the ALIAS actions, so columns needed by selected aliases stay available. They are still included in the storage's supported-PREWHERE-columns check.

@github-actions

Copy link
Copy Markdown

Workflow [PR], commit [2ffbf8f]

@mkmkme mkmkme self-assigned this Oct 23, 2026
@zvonand

zvonand commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

@blau-ai

@blau-ai

blau-ai commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

CI triage — 1 failing check, 0 PR-caused

Verdict: 1 failure total → 0 PR-related, 1 pre-existing/flaky. All other checks are green (every other stateless shard, all integration shards, stress, unit, SQLLogic, fuzzers, regression suites). This looks safe to re-run.

❌ Stateless tests (amd_asan_ubsan, cas s3 storage, parallel, 1/2) — Failed: 2

The two reported failures are both symptoms of a single server crash:

  • Server died (the suite-level marker)
  • 03261_sort_cursor_crash → UNKNOWN — its INSERT got Code: 236 ... server is shutting down due to a fatal error (ABORTED), i.e. it was merely the query in flight when the server was already going down, not the cause.

Actual fatal error (from clickhouse-server.log):

<Fatal> : Logical error: 'GroupingAggregatedTransform pushed bucket 6 twice'.
  src/Processors/Transforms/MergingAggregatedMemoryEfficientTransform.cpp:63
  DB::GroupingAggregatedTransform::pushData(...)
  ...tryPushTwoLevelData() -> prepare(...)

Crashing query (query id 7647a5a3-...):

-- 04605_parallel_replicas_merging_aggregated_bucket_order.sh
INSERT INTO res SELECT x, sum(y) FROM d GROUP BY x
SETTINGS enable_parallel_replicas = 1, max_parallel_replicas = 3,
         parallel_replicas_for_non_replicated_merge_tree = 1,
         prefer_localhost_replica = 0,
         distributed_aggregation_memory_efficient = 1,
         group_by_two_level_threshold = 1, max_threads = 8;

Classification: pre-existing / flaky — not caused by this PR.

Evidence:

  1. Different code path. This PR only touches old-analyzer row-policy ALIAS handling in src/Interpreters/InterpreterSelectQuery.cpp. The crash is in the distributed memory-efficient aggregation merge pipeline (MergingAggregatedMemoryEfficientTransform.cpp) — code the PR does not touch. The crashing query also runs through InterpreterSelectQueryAnalyzer (new analyzer), whereas the PR's changes are confined to the legacy interpreter.
  2. Unrelated test. The crash comes from 04605_parallel_replicas_merging_aggregated_bucket_order, a parallel-replicas aggregation bucket-ordering regression test — nothing to do with row policies or distributed reads with ALIAS.
  3. Known-fragile area. This exact assertion has a history of fixes already backported onto antalya-26.6, e.g. ce24e727daa ("Do not push a bucket while any input is still at it in GroupingAggregatedTransform", Do not push a bucket while any input is still at it in GroupingAggregatedTransform ClickHouse/ClickHouse#115487), f206a2e180c (Fix duplicated keys in nested distributed aggregation with out of order buckets ClickHouse/ClickHouse#112794, out-of-order buckets) and 6a19aaa577f (Fix wrong results of the partial aggregation strategy in distributed query plans ClickHouse/ClickHouse#114523). A race that still occasionally trips the pushed bucket X twice assertion under parallel replicas + group_by_two_level_threshold=1 is a recurring flaky in this path, not a regression from an unrelated row-policy change.
  4. The sibling shard 2/2 passed (5595 tests), and the PR's own new test (05316_row_policy_alias_column_distributed) is not among any failures.

Suggested next step: re-run the Stateless tests (amd_asan_ubsan, cas s3 storage, parallel, 1/2) job. No change to this PR is warranted for this failure. If the same GroupingAggregatedTransform pushed bucket X twice crash reproduces on re-run, it's an aggregation-pipeline issue to track separately (likely needs a further upstream fix backported), still independent of this backport.

Health check

Aside from that one flaky crash, the PR is in good shape: all builds pass, Fast test is clean (9487 passed), every other stateless shard and all 8 integration shards are green, stress/unit/SQLLogic/fuzzer/regression all pass. The change is a small, well-scoped backport confined to legacy row-policy ALIAS resolution with a dedicated new test.

🤖 blau-ai · evidence: result_pr.json, clickhouse-server.log for head 2ffbf8f

@zvonand
zvonand merged commit 2fa0e9c into antalya-26.6 Oct 24, 2026
477 of 483 checks passed
@zvonand zvonand added the verified Approved for release label Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants