Backport #72386 to 24.9: fix finalize/cancel write buffers

This commit is contained in:
robot-clickhouse 2024-12-12 17:13:35 +00:00
parent e56690a115
commit b3db0444e4
2 changed files with 2 additions and 1 deletions

View File

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

View File

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