Merge pull request #73229 from ClickHouse/backport/24.10/72386

Backport #72386 to 24.10: fix finalize/cancel write buffers
This commit is contained in:
robot-ch-test-poll1 2024-12-12 23:32:20 +04:00 committed by GitHub
commit 506545e098
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -74,6 +74,7 @@ void StorageObjectStorageSink::finalizeBuffers()
catch (...) catch (...)
{ {
/// Stop ParallelFormattingOutputFormat correctly. /// Stop ParallelFormattingOutputFormat correctly.
cancelBuffers();
releaseBuffers(); releaseBuffers();
throw; throw;
} }

View File

@ -561,7 +561,7 @@ void StorageMemory::restoreDataImpl(const BackupPtr & backup, const String & dat
temp_data_file.emplace(temporary_disk); temp_data_file.emplace(temporary_disk);
auto out = std::make_unique<WriteBufferFromFile>(temp_data_file->getAbsolutePath()); auto out = std::make_unique<WriteBufferFromFile>(temp_data_file->getAbsolutePath());
copyData(*in, *out); copyData(*in, *out);
out.reset(); out->finalize();
in = createReadBufferFromFileBase(temp_data_file->getAbsolutePath(), {}); in = createReadBufferFromFileBase(temp_data_file->getAbsolutePath(), {});
} }
std::unique_ptr<ReadBufferFromFileBase> in_from_file{static_cast<ReadBufferFromFileBase *>(in.release())}; std::unique_ptr<ReadBufferFromFileBase> in_from_file{static_cast<ReadBufferFromFileBase *>(in.release())};