Remove current_table_chosen_for_reading_with_parallel_replicas flag

This commit is contained in:
Igor Nikonov 2024-10-30 11:08:21 +00:00
parent 6d47ef8f22
commit 6004cb8ff4
4 changed files with 5 additions and 14 deletions

View File

@ -702,8 +702,6 @@ JoinTreeQueryPlan buildQueryPlanForTableExpression(QueryTreeNodePtr table_expres
table_expression_query_info.table_expression = table_expression; table_expression_query_info.table_expression = table_expression;
if (const auto & filter_actions = table_expression_data.getFilterActions()) if (const auto & filter_actions = table_expression_data.getFilterActions())
table_expression_query_info.filter_actions_dag = std::make_shared<const ActionsDAG>(filter_actions->clone()); table_expression_query_info.filter_actions_dag = std::make_shared<const ActionsDAG>(filter_actions->clone());
table_expression_query_info.current_table_chosen_for_reading_with_parallel_replicas
= table_node == planner_context->getGlobalPlannerContext()->parallel_replicas_table;
size_t max_streams = settings[Setting::max_threads]; size_t max_streams = settings[Setting::max_threads];
size_t max_threads_execute_query = settings[Setting::max_threads]; size_t max_threads_execute_query = settings[Setting::max_threads];
@ -918,10 +916,10 @@ JoinTreeQueryPlan buildQueryPlanForTableExpression(QueryTreeNodePtr table_expres
/// It is just a safety check needed until we have a proper sending plan to replicas. /// It is just a safety check needed until we have a proper sending plan to replicas.
/// If we have a non-trivial storage like View it might create its own Planner inside read(), run findTableForParallelReplicas() /// If we have a non-trivial storage like View it might create its own Planner inside read(), run findTableForParallelReplicas()
/// and find some other table that might be used for reading with parallel replicas. It will lead to errors. /// and find some other table that might be used for reading with parallel replicas. It will lead to errors.
const bool other_table_already_chosen_for_reading_with_parallel_replicas const bool other_table_chosen_for_reading_with_parallel_replicas
= planner_context->getGlobalPlannerContext()->parallel_replicas_table = planner_context->getGlobalPlannerContext()->parallel_replicas_table
&& !table_expression_query_info.current_table_chosen_for_reading_with_parallel_replicas; && table_node != planner_context->getGlobalPlannerContext()->parallel_replicas_table;
if (other_table_already_chosen_for_reading_with_parallel_replicas) if (other_table_chosen_for_reading_with_parallel_replicas)
{ {
chassert(query_context->canUseParallelReplicasOnFollower()); chassert(query_context->canUseParallelReplicasOnFollower());

View File

@ -162,8 +162,6 @@ struct SelectQueryInfo
/// It's guaranteed to be present in JOIN TREE of `query_tree` /// It's guaranteed to be present in JOIN TREE of `query_tree`
QueryTreeNodePtr table_expression; QueryTreeNodePtr table_expression;
bool current_table_chosen_for_reading_with_parallel_replicas = false;
/// Table expression modifiers for storage /// Table expression modifiers for storage
std::optional<TableExpressionModifiers> table_expression_modifiers; std::optional<TableExpressionModifiers> table_expression_modifiers;

View File

@ -276,9 +276,7 @@ void StorageMergeTree::read(
} }
const bool enable_parallel_reading = local_context->canUseParallelReplicasOnFollower() const bool enable_parallel_reading = local_context->canUseParallelReplicasOnFollower()
&& local_context->getSettingsRef()[Setting::parallel_replicas_for_non_replicated_merge_tree] && local_context->getSettingsRef()[Setting::parallel_replicas_for_non_replicated_merge_tree];
&& (!local_context->getSettingsRef()[Setting::allow_experimental_analyzer]
|| query_info.current_table_chosen_for_reading_with_parallel_replicas);
if (auto plan = reader.read( if (auto plan = reader.read(
column_names, column_names,

View File

@ -5640,10 +5640,7 @@ void StorageReplicatedMergeTree::readLocalImpl(
const size_t max_block_size, const size_t max_block_size,
const size_t num_streams) const size_t num_streams)
{ {
const bool enable_parallel_reading = local_context->canUseParallelReplicasOnFollower() const bool enable_parallel_reading = local_context->canUseParallelReplicasOnFollower();
&& (!local_context->getSettingsRef()[Setting::allow_experimental_analyzer]
|| query_info.current_table_chosen_for_reading_with_parallel_replicas);
auto plan = reader.read( auto plan = reader.read(
column_names, storage_snapshot, query_info, column_names, storage_snapshot, query_info,
local_context, max_block_size, num_streams, local_context, max_block_size, num_streams,