Add ability to bypass storage metadata cache#89283
Merged
Michicosun merged 4 commits intomasterfrom Oct 31, 2025
Merged
Conversation
Contributor
azat
reviewed
Oct 31, 2025
Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
azat
reviewed
Oct 31, 2025
| @@ -628,7 +628,7 @@ StorageReplicatedMergeTree::StorageReplicatedMergeTree( | |||
| * Otherwise `metadata_version` for not first replica will be initialized with 0 by default. | |||
| */ | |||
| setInMemoryMetadata(metadata_snapshot->withMetadataVersion(metadata_version)); | |||
Member
There was a problem hiding this comment.
After looking into this again, I have another idea/question, maybe clearing the cache in setInMemoryMetadata will be less error prone? Not sure that it make sense for this fix, but interesting what you think
Member
Author
There was a problem hiding this comment.
It will definitely work, but this will be a strange side effect of updating a storage field.
…/ClickHouse into bypass_storage_metadata_cache
azat
approved these changes
Oct 31, 2025
Member
Author
|
CI: #88807 |
amosbird
reviewed
Dec 9, 2025
| */ | ||
| setInMemoryMetadata(metadata_snapshot->withMetadataVersion(metadata_version)); | ||
| metadata_snapshot = getInMemoryMetadataPtr(); | ||
| metadata_snapshot = getInMemoryMetadataPtr(/*bypass_metadata_cache=*/true); |
Collaborator
There was a problem hiding this comment.
Is there a regression test covering this? I'm trying to understand the related issues. Perhaps we could address all of them by simply avoiding the cache for queries that involve DDL. The tricky part might be separating the contexts in CTAS queries.
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.
Changelog category (leave one):
Details
Storage metadata cache can be enabled using
enable_shared_storage_snapshot_in_query. It was added to the query context instead of being part of the query analyzer/planner, which can lead to invalid usage of cached metadata where it should not be cached.