Skip to content

Antalya 26.8, backport of 120098: Keep the target storage alive for a snapshot handed out by an Alias table - #2617

Open
ianton-ru wants to merge 1 commit into
antalya-26.8from
bugfix/antalya-26.8/alias-snapshot-storage-holder
Open

ianton-ru wants to merge 1 commit into
antalya-26.8from
bugfix/antalya-26.8/alias-snapshot-storage-holder

Conversation

@ianton-ru

@ianton-ru ianton-ru commented Oct 20, 2026 •

Copy link
Copy Markdown

Backport of ClickHouse#120098 by @groeneai.

StorageSnapshot refers to its storage through a bare reference. Alias::getStorageSnapshot forwards to getTargetTable, and that call returns the owning pointer by value, so it dies at the end of the expression. The snapshot then refers to the target with no owner, while the query owns and share-locks the Alias instead. Upstream fixed that lifetime gap after a TSan report during join reordering. The same gap is what ASan hit on antalya-26.6 in QueryAnalyzer::initializeTableExpressionData for an Alias over a catalog Iceberg table.

withStorageHolder returns a new snapshot instead of writing the holder into a snapshot that other readers of the query may already share. An Alias chain keeps the first holder, so the pin stays on the innermost storage. Both clone overloads copy the holder.

Related: ClickHouse#120098
Related: #2557

Changelog category (leave one):

  • Critical Bug Fix (crash, data loss, RBAC)

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

Reading through an Alias no longer uses a freed target storage. The snapshot keeps that storage alive until the query releases it. (ClickHouse#120098 by @groeneai)

Documentation entry for user-facing changes

No user-facing documentation change.

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)

`StorageSnapshot` keeps a bare reference to its storage, and `Alias` returned that snapshot after the temporary from `getTargetTable` was destroyed. A concurrent drop could free the target while planning still read it.

https: //github.com/ClickHouse/pull/120098
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown

Workflow [PR], commit [9880c12]

@ianton-ru ianton-ru added antalya backport Backport antalya-26.8 Session label (releasy session config) labels Oct 20, 2026

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

antalya antalya-26.8 Session label (releasy session config) backport Backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant