Repository navigation
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
Conversation
`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>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of ClickHouse#120098 by @groeneai.
StorageSnapshotrefers to its storage through a bare reference.Alias::getStorageSnapshotforwards togetTargetTable, 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 theAliasinstead. Upstream fixed that lifetime gap after a TSan report during join reordering. The same gap is what ASan hit onantalya-26.6inQueryAnalyzer::initializeTableExpressionDatafor anAliasover a catalogIcebergtable.withStorageHolderreturns a new snapshot instead of writing the holder into a snapshot that other readers of the query may already share. AnAliaschain keeps the first holder, so the pin stays on the innermost storage. Bothcloneoverloads copy the holder.Related: ClickHouse#120098
Related: #2557
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Reading through an
Aliasno 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:
Regression jobs to run: