mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 06:01:57 +00:00
Wait for tasks finish when scheduler failed
This commit is contained in:
parent
3e77463125
commit
cfb832b205
@ -66,17 +66,7 @@ namespace
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~UploadHelper()
|
||||
{
|
||||
try
|
||||
{
|
||||
waitForAllBackGroundTasks();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
tryLogCurrentException(__PRETTY_FUNCTION__);
|
||||
}
|
||||
}
|
||||
virtual ~UploadHelper() = default;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<const S3::Client> client_ptr;
|
||||
@ -219,17 +209,27 @@ namespace
|
||||
size_t position = start_offset;
|
||||
size_t end_position = start_offset + size;
|
||||
|
||||
for (size_t part_number = 1; position < end_position; ++part_number)
|
||||
try
|
||||
{
|
||||
if (multipart_upload_aborted)
|
||||
break; /// No more part uploads.
|
||||
for (size_t part_number = 1; position < end_position; ++part_number)
|
||||
{
|
||||
if (multipart_upload_aborted)
|
||||
break; /// No more part uploads.
|
||||
|
||||
size_t next_position = std::min(position + normal_part_size, end_position);
|
||||
size_t part_size = next_position - position; /// `part_size` is either `normal_part_size` or smaller if it's the final part.
|
||||
size_t next_position = std::min(position + normal_part_size, end_position);
|
||||
size_t part_size = next_position - position; /// `part_size` is either `normal_part_size` or smaller if it's the final part.
|
||||
|
||||
uploadPart(part_number, position, part_size);
|
||||
uploadPart(part_number, position, part_size);
|
||||
|
||||
position = next_position;
|
||||
position = next_position;
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
tryLogCurrentException(__PRETTY_FUNCTION__);
|
||||
abortMultipartUpload();
|
||||
waitForAllBackGroundTasks();
|
||||
throw;
|
||||
}
|
||||
|
||||
waitForAllBackGroundTasks();
|
||||
|
Loading…
Reference in New Issue
Block a user