From 517e84cfb9975ae71fffdea777baeab51b57cfe2 Mon Sep 17 00:00:00 2001 From: Vitaly Baranov Date: Fri, 9 Dec 2022 02:19:07 +0100 Subject: [PATCH] Finalize buffers after writing. --- src/Storages/MergeTree/MergeTreeData.cpp | 1 + src/Storages/StorageLog.cpp | 1 + src/Storages/StorageStripeLog.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/src/Storages/MergeTree/MergeTreeData.cpp b/src/Storages/MergeTree/MergeTreeData.cpp index d2b1da9abf8..a1e6c2a92d7 100644 --- a/src/Storages/MergeTree/MergeTreeData.cpp +++ b/src/Storages/MergeTree/MergeTreeData.cpp @@ -4523,6 +4523,7 @@ void MergeTreeData::restorePartFromBackup(std::shared_ptr r auto read_buffer = backup_entry->getReadBuffer(); auto write_buffer = disk->writeFile(temp_part_dir / filename); copyData(*read_buffer, *write_buffer); + write_buffer->finalize(); reservation->update(reservation->getSize() - backup_entry->getSize()); } diff --git a/src/Storages/StorageLog.cpp b/src/Storages/StorageLog.cpp index 8ed33220507..b8920647244 100644 --- a/src/Storages/StorageLog.cpp +++ b/src/Storages/StorageLog.cpp @@ -1032,6 +1032,7 @@ void StorageLog::restoreDataImpl(const BackupPtr & backup, const String & data_p auto in = backup_entry->getReadBuffer(); auto out = disk->writeFile(data_file.path, max_compress_block_size, WriteMode::Append); copyData(*in, *out); + out->finalize(); } if (use_marks_file) diff --git a/src/Storages/StorageStripeLog.cpp b/src/Storages/StorageStripeLog.cpp index 92d53ffc1ac..62823f6dabd 100644 --- a/src/Storages/StorageStripeLog.cpp +++ b/src/Storages/StorageStripeLog.cpp @@ -626,6 +626,7 @@ void StorageStripeLog::restoreDataImpl(const BackupPtr & backup, const String & auto in = backup_entry->getReadBuffer(); auto out = disk->writeFile(data_file_path, max_compress_block_size, WriteMode::Append); copyData(*in, *out); + out->finalize(); } /// Append the index.