mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 00:52:02 +00:00
Keep parent part alive for read task
This commit is contained in:
parent
195ea4ec1f
commit
173d5d0b98
@ -53,7 +53,7 @@ MergeTreePrefetchedReadPool::PrefetchedReaders::PrefetchedReaders(
|
||||
MergeTreePrefetchedReadPool & read_prefetch)
|
||||
: is_valid(true)
|
||||
, readers(std::move(readers_))
|
||||
, prefetch_runner(pool, "Prefetch")
|
||||
, prefetch_runner(pool, "ReadPrepare")
|
||||
{
|
||||
prefetch_runner(read_prefetch.createPrefetchedTask(readers.main.get(), priority_));
|
||||
|
||||
|
@ -6,6 +6,11 @@
|
||||
namespace DB
|
||||
{
|
||||
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int LOGICAL_ERROR;
|
||||
}
|
||||
|
||||
MergeTreeReadPoolBase::MergeTreeReadPoolBase(
|
||||
RangesInDataParts && parts_,
|
||||
VirtualFields shared_virtual_fields_,
|
||||
@ -48,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;
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user