mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Merge pull request #36857 from ClickHouse/dont_finalize_s3_buffer
Terminate if S3 buffer is not finalized
This commit is contained in:
commit
5c725fe77c
@ -151,6 +151,13 @@ void WriteBufferFromS3::allocateBuffer()
|
||||
|
||||
WriteBufferFromS3::~WriteBufferFromS3()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if (!is_finalized)
|
||||
{
|
||||
LOG_ERROR(log, "WriteBufferFromS3 is not finalized in destructor. It's a bug");
|
||||
std::terminate();
|
||||
}
|
||||
#else
|
||||
try
|
||||
{
|
||||
finalize();
|
||||
@ -159,6 +166,7 @@ WriteBufferFromS3::~WriteBufferFromS3()
|
||||
{
|
||||
tryLogCurrentException(__PRETTY_FUNCTION__);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool WriteBufferFromS3::cacheEnabled() const
|
||||
@ -192,6 +200,8 @@ void WriteBufferFromS3::finalizeImpl()
|
||||
|
||||
if (!multipart_upload_id.empty())
|
||||
completeMultipartUpload();
|
||||
|
||||
is_finalized = true;
|
||||
}
|
||||
|
||||
void WriteBufferFromS3::createMultipartUpload()
|
||||
|
@ -47,7 +47,7 @@ class WriteBufferFromFile;
|
||||
class WriteBufferFromS3 final : public BufferWithOwnMemory<WriteBuffer>
|
||||
{
|
||||
public:
|
||||
explicit WriteBufferFromS3(
|
||||
WriteBufferFromS3(
|
||||
std::shared_ptr<Aws::S3::S3Client> client_ptr_,
|
||||
const String & bucket_,
|
||||
const String & key_,
|
||||
@ -105,6 +105,7 @@ private:
|
||||
std::vector<String> part_tags;
|
||||
|
||||
bool is_prefinalized = false;
|
||||
bool is_finalized = false;
|
||||
|
||||
/// Following fields are for background uploads in thread pool (if specified).
|
||||
/// We use std::function to avoid dependency of Interpreters
|
||||
|
Loading…
Reference in New Issue
Block a user