Merge pull request #54904 from ClickHouse/pufit/fix-s3-division-by-zero

Fix division by zero in StorageS3
This commit is contained in:
robot-ch-test-poll1 2023-09-22 03:51:59 +02:00 committed by GitHub
commit 50253f23fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1085,7 +1085,7 @@ Pipe StorageS3::read(
&& local_context->getSettingsRef().optimize_count_from_files;
const size_t max_threads = local_context->getSettingsRef().max_threads;
const size_t max_parsing_threads = num_streams >= max_threads ? 1 : (max_threads / num_streams);
const size_t max_parsing_threads = num_streams >= max_threads ? 1 : (max_threads / std::max(num_streams, 1ul));
LOG_DEBUG(&Poco::Logger::get("StorageS3"), "Reading in {} streams, {} threads per stream", num_streams, max_parsing_threads);
pipes.reserve(num_streams);