This commit is contained in:
Nikita Taranov 2024-08-16 21:29:46 +01:00
parent b64af2812f
commit a6d5047bb0
7 changed files with 46 additions and 0 deletions

View File

@ -395,6 +395,10 @@ void MergeTreePrefetchedReadPool::fillPerThreadTasks(size_t threads, size_t sum_
part_stat.prefetch_step_marks = std::max(part_stat.prefetch_step_marks, per_part_infos[i]->min_marks_per_task);
if (part_stat.prefetch_step_marks == 0)
throw Exception(
ErrorCodes::BAD_ARGUMENTS, "Chosen number of marks to read is zero (likely because of weird interference of settings)");
LOG_DEBUG(
log,
"Part: {}, sum_marks: {}, approx mark size: {}, prefetch_step_bytes: {}, prefetch_step_marks: {}, (ranges: {})",

View File

@ -13,6 +13,7 @@ namespace DB
namespace ErrorCodes
{
extern const int LOGICAL_ERROR;
extern const int BAD_ARGUMENTS;
}
MergeTreeReadPoolBase::MergeTreeReadPoolBase(
@ -85,6 +86,11 @@ static size_t calculateMinMarksPerTask(
min_marks_per_task = heuristic_min_marks;
}
}
if (min_marks_per_task == 0)
throw Exception(
ErrorCodes::BAD_ARGUMENTS, "Chosen number of marks to read is zero (likely because of weird interference of settings)");
LOG_TEST(&Poco::Logger::get("MergeTreeReadPoolBase"), "Will use min_marks_per_task={}", min_marks_per_task);
return min_marks_per_task;
}

View File

@ -8,6 +8,7 @@ namespace DB
namespace ErrorCodes
{
extern const int LOGICAL_ERROR;
extern const int BAD_ARGUMENTS;
}
MergeTreeReadPoolParallelReplicas::MergeTreeReadPoolParallelReplicas(
@ -38,6 +39,10 @@ MergeTreeReadPoolParallelReplicas::MergeTreeReadPoolParallelReplicas(
for (const auto & info : per_part_infos)
min_marks_per_task = std::max(min_marks_per_task, info->min_marks_per_task);
if (min_marks_per_task == 0)
throw Exception(
ErrorCodes::BAD_ARGUMENTS, "Chosen number of marks to read is zero (likely because of weird interference of settings)");
extension.all_callback(
InitialAllRangesAnnouncement(coordination_mode, parts_ranges.getDescriptions(), extension.number_of_current_replica));
}

View File

@ -6,6 +6,7 @@ namespace DB
namespace ErrorCodes
{
extern const int LOGICAL_ERROR;
extern const int BAD_ARGUMENTS;
}
MergeTreeReadPoolParallelReplicasInOrder::MergeTreeReadPoolParallelReplicasInOrder(
@ -37,6 +38,10 @@ MergeTreeReadPoolParallelReplicasInOrder::MergeTreeReadPoolParallelReplicasInOrd
for (const auto & info : per_part_infos)
min_marks_per_task = std::max(min_marks_per_task, info->min_marks_per_task);
if (min_marks_per_task == 0)
throw Exception(
ErrorCodes::BAD_ARGUMENTS, "Chosen number of marks to read is zero (likely because of weird interference of settings)");
for (const auto & part : parts_ranges)
request.push_back({part.data_part->info, MarkRanges{}});

View File

@ -1004,6 +1004,10 @@ void ParallelReplicasReadingCoordinator::handleInitialAllRangesAnnouncement(Init
ParallelReadResponse ParallelReplicasReadingCoordinator::handleRequest(ParallelReadRequest request)
{
if (request.min_number_of_marks == 0)
throw Exception(
ErrorCodes::BAD_ARGUMENTS, "Chosen number of marks to read is zero (likely because of weird interference of settings)");
ProfileEventTimeIncrement<Microseconds> watch(ProfileEvents::ParallelReplicasHandleRequestMicroseconds);
std::lock_guard lock(mutex);

View File

@ -0,0 +1,22 @@
DROP TABLE IF EXISTS test__fuzz_22 SYNC;
CREATE TABLE test__fuzz_22 (k Float32, v String) ENGINE = MergeTree ORDER BY k SETTINGS index_granularity = 1;
SYSTEM STOP MERGES test__fuzz_22;
INSERT INTO test__fuzz_22 SELECT number, toString(number) FROM numbers(1);
INSERT INTO test__fuzz_22 SELECT number, toString(number) FROM numbers(1);
INSERT INTO test__fuzz_22 SELECT number, toString(number) FROM numbers(1);
INSERT INTO test__fuzz_22 SELECT number, toString(number) FROM numbers(1);
SET allow_experimental_parallel_reading_from_replicas = 2, parallel_replicas_for_non_replicated_merge_tree = 1, max_parallel_replicas = 3, cluster_for_parallel_replicas='test_cluster_one_shard_three_replicas_localhost',
merge_tree_min_rows_for_concurrent_read = 9223372036854775806, merge_tree_min_rows_for_concurrent_read_for_remote_filesystem = 9223372036854775806;
SELECT v
FROM test__fuzz_22
ORDER BY v
LIMIT 10, 10
SETTINGS max_threads = 4
FORMAT Null; -- { serverError BAD_ARGUMENTS }
DROP TABLE test__fuzz_22 SYNC;