Merge pull request #63595 from ClickHouse/backport/24.3/63513

Backport #63513 to 24.3: Make `MergeTreePrefetchedReadPool` safer
This commit is contained in:
robot-clickhouse 2024-05-21 15:10:57 +02:00 committed by GitHub
commit 157d6c48fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View File

@ -53,6 +53,19 @@ void MergeTreeReadPoolBase::fillPerPartInfos()
MergeTreeReadTaskInfo read_task_info;
read_task_info.data_part = part_with_ranges.data_part;
const auto & data_part = read_task_info.data_part;
if (data_part->isProjectionPart())
{
read_task_info.parent_part = data_part->storage.getPartIfExists(
data_part->getParentPartName(),
{MergeTreeDataPartState::PreActive, MergeTreeDataPartState::Active, MergeTreeDataPartState::Outdated});
if (!read_task_info.parent_part)
throw Exception(ErrorCodes::LOGICAL_ERROR, "Did not find parent part {} for projection part {}",
data_part->getParentPartName(), data_part->getDataPartStorage().getFullPath());
}
read_task_info.part_index_in_query = part_with_ranges.part_index_in_query;
read_task_info.alter_conversions = part_with_ranges.alter_conversions;

View File

@ -56,6 +56,8 @@ struct MergeTreeReadTaskInfo
{
/// Data part which should be read while performing this task
DataPartPtr data_part;
/// Parent part of the projection part
DataPartPtr parent_part;
/// For `part_index` virtual column
size_t part_index_in_query;
/// Alter converversionss that should be applied on-fly for part.