From 933a38269cc3564685546939e4d10be520237fd0 Mon Sep 17 00:00:00 2001 From: Sema Checherinda Date: Fri, 16 Dec 2022 13:00:21 +0100 Subject: [PATCH] assert that setting are not empty --- src/IO/WriteBufferFromS3.cpp | 12 ++++++++++++ src/IO/WriteBufferFromS3.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/IO/WriteBufferFromS3.cpp b/src/IO/WriteBufferFromS3.cpp index d5ec2eeee39..10430225792 100644 --- a/src/IO/WriteBufferFromS3.cpp +++ b/src/IO/WriteBufferFromS3.cpp @@ -90,6 +90,17 @@ WriteBufferFromS3::WriteBufferFromS3( allocateBuffer(); } +void WriteBufferFromS3::assertSettings() const +{ + assert(request_settings.min_upload_part_size > 0); + assert(request_settings.max_upload_part_size > 0); + assert(request_settings.upload_part_size_multiply_factor > 0); + assert(request_settings.upload_part_size_multiply_parts_count_threshold > 0); + assert(request_settings.max_part_number > 0); + assert(request_settings.max_single_part_upload_size > 0); + assert(request_settings.max_unexpected_write_error_retries > 0); +} + void WriteBufferFromS3::nextImpl() { if (!offset()) @@ -111,6 +122,7 @@ void WriteBufferFromS3::nextImpl() if (multipart_upload_id.empty() && last_part_size > request_settings.max_single_part_upload_size) createMultipartUpload(); + assert(upload_part_size>0); if (!multipart_upload_id.empty() && last_part_size > upload_part_size) { writePart(); diff --git a/src/IO/WriteBufferFromS3.h b/src/IO/WriteBufferFromS3.h index 1663b186437..ff37dc53f02 100644 --- a/src/IO/WriteBufferFromS3.h +++ b/src/IO/WriteBufferFromS3.h @@ -63,6 +63,7 @@ public: void preFinalize() override; private: + void assertSettings() const; void allocateBuffer(); void createMultipartUpload();