mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Fix for incorrect result when parallel replicas not completely disabled
This commit is contained in:
parent
04d745a5e0
commit
c0629a38d1
@ -7196,7 +7196,10 @@ QueryProcessingStage::Enum MergeTreeData::getQueryProcessingStage(
|
|||||||
if (query_context->canUseParallelReplicasOnInitiator() && to_stage >= QueryProcessingStage::WithMergeableState)
|
if (query_context->canUseParallelReplicasOnInitiator() && to_stage >= QueryProcessingStage::WithMergeableState)
|
||||||
{
|
{
|
||||||
if (!canUseParallelReplicasBasedOnPKAnalysis(query_context, storage_snapshot, query_info))
|
if (!canUseParallelReplicasBasedOnPKAnalysis(query_context, storage_snapshot, query_info))
|
||||||
|
{
|
||||||
|
query_info.parallel_replicas_disabled = true;
|
||||||
return QueryProcessingStage::Enum::FetchColumns;
|
return QueryProcessingStage::Enum::FetchColumns;
|
||||||
|
}
|
||||||
|
|
||||||
/// ReplicatedMergeTree
|
/// ReplicatedMergeTree
|
||||||
if (supportsReplication())
|
if (supportsReplication())
|
||||||
|
@ -255,6 +255,8 @@ struct SelectQueryInfo
|
|||||||
Block minmax_count_projection_block;
|
Block minmax_count_projection_block;
|
||||||
MergeTreeDataSelectAnalysisResultPtr merge_tree_select_result_ptr;
|
MergeTreeDataSelectAnalysisResultPtr merge_tree_select_result_ptr;
|
||||||
|
|
||||||
|
bool parallel_replicas_disabled = false;
|
||||||
|
|
||||||
bool is_parameterized_view = false;
|
bool is_parameterized_view = false;
|
||||||
NameToNameMap parameterized_view_values;
|
NameToNameMap parameterized_view_values;
|
||||||
|
|
||||||
|
@ -209,7 +209,9 @@ void StorageMergeTree::read(
|
|||||||
size_t max_block_size,
|
size_t max_block_size,
|
||||||
size_t num_streams)
|
size_t num_streams)
|
||||||
{
|
{
|
||||||
if (local_context->canUseParallelReplicasOnInitiator() && local_context->getSettingsRef().parallel_replicas_for_non_replicated_merge_tree)
|
if (!query_info.parallel_replicas_disabled &&
|
||||||
|
local_context->canUseParallelReplicasOnInitiator() &&
|
||||||
|
local_context->getSettingsRef().parallel_replicas_for_non_replicated_merge_tree)
|
||||||
{
|
{
|
||||||
auto table_id = getStorageID();
|
auto table_id = getStorageID();
|
||||||
|
|
||||||
@ -240,7 +242,10 @@ void StorageMergeTree::read(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const bool enable_parallel_reading = local_context->canUseParallelReplicasOnFollower() && local_context->getSettingsRef().parallel_replicas_for_non_replicated_merge_tree;
|
const bool enable_parallel_reading =
|
||||||
|
!query_info.parallel_replicas_disabled &&
|
||||||
|
local_context->canUseParallelReplicasOnFollower() &&
|
||||||
|
local_context->getSettingsRef().parallel_replicas_for_non_replicated_merge_tree;
|
||||||
|
|
||||||
if (auto plan = reader.read(
|
if (auto plan = reader.read(
|
||||||
column_names, storage_snapshot, query_info,
|
column_names, storage_snapshot, query_info,
|
||||||
|
Loading…
Reference in New Issue
Block a user