mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Merge pull request #63346 from ClickHouse/vdimir/fix_write_buffer_file_segment_dtor
Fix finalize WriteBufferToFileSegment and StatusFile
This commit is contained in:
commit
4b1af861d8
@ -86,6 +86,8 @@ StatusFile::StatusFile(std::string path_, FillFunction fill_)
|
||||
/// Write information about current server instance to the file.
|
||||
WriteBufferFromFileDescriptor out(fd, 1024);
|
||||
fill(out);
|
||||
/// Finalize here to avoid throwing exceptions in destructor.
|
||||
out.finalize();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -110,14 +110,11 @@ void WriteBufferToFileSegment::nextImpl()
|
||||
|
||||
std::unique_ptr<ReadBuffer> WriteBufferToFileSegment::getReadBufferImpl()
|
||||
{
|
||||
/** Finalize here and we don't need to finalize in the destructor,
|
||||
* because in case destructor called without `getReadBufferImpl` called, data won't be read.
|
||||
*/
|
||||
finalize();
|
||||
return std::make_unique<ReadBufferFromFile>(file_segment->getPath());
|
||||
}
|
||||
|
||||
WriteBufferToFileSegment::~WriteBufferToFileSegment()
|
||||
{
|
||||
/// To be sure that file exists before destructor of segment_holder is called
|
||||
WriteBufferFromFileDecorator::finalize();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ public:
|
||||
explicit WriteBufferToFileSegment(FileSegmentsHolderPtr segment_holder);
|
||||
|
||||
void nextImpl() override;
|
||||
~WriteBufferToFileSegment() override;
|
||||
|
||||
private:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user