diff --git a/src/Core/Settings.cpp b/src/Core/Settings.cpp index 9f913a4ff9a..c8582b6f646 100644 --- a/src/Core/Settings.cpp +++ b/src/Core/Settings.cpp @@ -5652,6 +5652,9 @@ Parts virtually divided into segments to be distributed between replicas for par )", BETA) \ DECLARE(Bool, parallel_replicas_local_plan, true, R"( Build local plan for local replica +)", BETA) \ + DECLARE(Bool, parallel_replicas_skip_index_analysis_on_workers, true, R"( +Skip index analysis on workers. Effective only with enabled parallel_replicas_local_plan )", BETA) \ \ DECLARE(Bool, allow_experimental_analyzer, true, R"( diff --git a/src/Core/SettingsChangesHistory.cpp b/src/Core/SettingsChangesHistory.cpp index f0d3e001362..c4cf5cf22a1 100644 --- a/src/Core/SettingsChangesHistory.cpp +++ b/src/Core/SettingsChangesHistory.cpp @@ -90,6 +90,7 @@ static std::initializer_listgetSettingsRef(); + if (context->canUseParallelReplicasOnFollower() && settings[Setting::parallel_replicas_local_plan] + && settings[Setting::parallel_replicas_skip_index_analysis_on_workers]) + { + RangesInDataParts parts_with_ranges; + parts_with_ranges.reserve(parts.size()); + for (size_t part_index = 0; part_index < parts.size(); ++part_index) + { + const auto & part = parts[part_index]; + // LOG_DEBUG(getLogger(__PRETTY_FUNCTION__), "part {}", part->getNameWithState()); + + MarkRanges ranges; + ranges.emplace_back(0, part->getMarksCount()); + parts_with_ranges.emplace_back(part, part_index, std::move(ranges)); + } + return parts_with_ranges; + } + if (use_skip_indexes && settings[Setting::force_data_skipping_indices].changed) { const auto & indices_str = settings[Setting::force_data_skipping_indices].toString(); @@ -673,6 +690,8 @@ RangesInDataParts MergeTreeDataSelectExecutor::filterPartsByPrimaryKeyAndSkipInd std::atomic sum_marks_pk = 0; std::atomic sum_parts_pk = 0; + RangesInDataParts parts_with_ranges(parts.size()); + /// Let's find what range to read from each part. { auto mark_cache = context->getIndexMarkCache(); diff --git a/tests/integration/test_parallel_replicas_all_marks_read/test.py b/tests/integration/test_parallel_replicas_all_marks_read/test.py index 593b98126df..92317afabbe 100644 --- a/tests/integration/test_parallel_replicas_all_marks_read/test.py +++ b/tests/integration/test_parallel_replicas_all_marks_read/test.py @@ -71,6 +71,7 @@ def _get_result_with_parallel_replicas( "cluster_for_parallel_replicas": f"{cluster_name}", "parallel_replicas_mark_segment_size": parallel_replicas_mark_segment_size, "query_id": query_id, + "parallel_replicas_skip_index_analysis_on_workers": False, }, )