Fix possibly dangling reference to target table of MV#15984
Merged
Conversation
akuzm
reviewed
Oct 15, 2020
| res.out = std::move(out_streams.at(0)); | ||
|
|
||
| res.pipeline.addStorageHolder(table); | ||
| if (const auto * mv = dynamic_cast<const StorageMaterializedView *>(table.get())) |
Contributor
There was a problem hiding this comment.
When we add one storage holder, do we always have to add the entire hierarchy?
There is also a similar pipeline construction in QueryPlan/ReadFromStorage.cpp:94, does it need any treatment?
Maybe we have to adopt some simple ownership strategy, like 'a storage holder also holds all nested storages'...
Member
Author
There was a problem hiding this comment.
ReadFromStorageStep doesn't know about nested storages, so if some storage calls read or write for another one, then it's responsible for table locks and lifetime of nested storages. However, in write method we cannot add storage holders to pipeline, because IStorage::write(...) returns BlockOutputStreamPtr, so when inserting directly into MV we add it here.
Merged
alesapin
approved these changes
Oct 21, 2020
This was referenced Oct 21, 2020
robot-clickhouse
pushed a commit
that referenced
this pull request
Oct 21, 2020
robot-clickhouse
pushed a commit
that referenced
this pull request
Oct 21, 2020
robot-clickhouse
pushed a commit
that referenced
this pull request
Oct 21, 2020
tavplubix
added a commit
that referenced
this pull request
Oct 21, 2020
Backport #15984 to 20.10: Fix possibly dangling reference to target table of MV
tavplubix
added a commit
that referenced
this pull request
Oct 21, 2020
Backport #15984 to 20.9: Fix possibly dangling reference to target table of MV
tavplubix
added a commit
that referenced
this pull request
Oct 21, 2020
Backport #15984 to 20.8: Fix possibly dangling reference to target table of MV
robot-clickhouse
pushed a commit
that referenced
this pull request
Oct 25, 2020
tavplubix
added a commit
that referenced
this pull request
Oct 26, 2020
Backport #15984 to 20.7: Fix possibly dangling reference to target table of MV
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.
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix rare segfaults when inserting into or selecting from MaterializedView and concurrently dropping target table (for Atomic database engine).
Fixes https://clickhouse-test-reports.s3.yandex.net/0/13896cf4c92d6cf0962a2e9bb181dfe42045d39c/stress_test_(thread)/stderr.log and https://clickhouse-test-reports.s3.yandex.net/0/57575a5a12721682f07ff813460c6edb4b85b2c7/stress_test_(thread)/stderr.log