Fix: progress bar for reading in order

This commit is contained in:
Igor Nikonov 2024-06-28 22:17:34 +00:00
parent 9b694e611c
commit ebcf455f4a
2 changed files with 8 additions and 7 deletions

View File

@ -592,8 +592,10 @@ Pipe ReadFromMergeTree::readInOrder(
/// Also do not count amount of read rows if we read in order of sorting key,
/// because we don't know actual amount of read rows in case when limit is set.
const UInt64 in_order_limit = query_info.input_order_info ? query_info.input_order_info->limit : 0;
const bool set_total_rows_approx
= !(is_parallel_reading_from_replicas && context->canUseParallelReplicasOnFollower()) && !in_order_limit;
const bool parallel_replicas_remote_plan_for_initiator = is_parallel_reading_from_replicas
&& !context->getSettingsRef().parallel_replicas_local_plan && context->canUseParallelReplicasOnInitiator();
const bool parallel_replicas_follower = is_parallel_reading_from_replicas && context->canUseParallelReplicasOnFollower();
const bool set_total_rows_approx = !parallel_replicas_follower && !parallel_replicas_remote_plan_for_initiator && !in_order_limit;
Pipes pipes;
for (size_t i = 0; i < parts_with_ranges.size(); ++i)
@ -1968,8 +1970,7 @@ void ReadFromMergeTree::initializePipeline(QueryPipelineBuilder & pipeline, cons
mode = CoordinationMode::ReverseOrder;
break;
case ReadFromMergeTree::ReadType::ParallelReplicas:
chassert(false);
UNREACHABLE();
throw Exception(ErrorCodes::LOGICAL_ERROR, "Read type can't be ParallelReplicas on initiator");
}
chassert(number_of_current_replica.has_value());

View File

@ -888,9 +888,8 @@ void InOrderCoordinator<mode>::doHandleInitialAllRangesAnnouncement(InitialAllRa
++stats[announcement.replica_num].number_of_requests;
/// FIXME: this code updating total_rows_to_read but it needs to be done only once since we're taking working set from initiator
/// util I missing something, it seems this code is not necessary if working set is taken from initiator (todo: check it)
if (new_rows_to_read > 0 && progress_callback)
// progress_callback is not set when local plan is used for initiator
if (progress_callback && new_rows_to_read > 0)
{
Progress progress;
progress.total_rows_to_read = new_rows_to_read;
@ -1052,6 +1051,7 @@ void ParallelReplicasReadingCoordinator::initialize(CoordinationMode mode)
break;
}
// progress_callback is not set when local plan is used for initiator
if (progress_callback)
pimpl->setProgressCallback(std::move(progress_callback));