assert that setting are not empty

This commit is contained in:
Sema Checherinda 2022-12-16 13:00:21 +01:00 committed by Nikolai Kochetov
parent e3aa2d9d56
commit 933a38269c
2 changed files with 13 additions and 0 deletions

View File

@ -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();

View File

@ -63,6 +63,7 @@ public:
void preFinalize() override;
private:
void assertSettings() const;
void allocateBuffer();
void createMultipartUpload();