Add finalize calls

This commit is contained in:
Antonio Andelic 2023-06-01 12:54:00 +00:00
parent a9eb2c3c4e
commit e8442b7a88
2 changed files with 12 additions and 3 deletions

View File

@ -43,7 +43,8 @@ void moveFileBetweenDisks(DiskPtr disk_from, ChangelogFileDescriptionPtr descrip
auto from_path = fs::path(description->path); auto from_path = fs::path(description->path);
auto tmp_changelog_name = from_path.parent_path() / (std::string{tmp_prefix} + from_path.filename().string()); auto tmp_changelog_name = from_path.parent_path() / (std::string{tmp_prefix} + from_path.filename().string());
{ {
disk_to->writeFile(tmp_changelog_name); auto buf = disk_to->writeFile(tmp_changelog_name);
buf->finalize();
} }
disk_from->copyFile(from_path, *disk_to, path_to, {}); disk_from->copyFile(from_path, *disk_to, path_to, {});
disk_to->removeFile(tmp_changelog_name); disk_to->removeFile(tmp_changelog_name);
@ -342,9 +343,15 @@ private:
} }
if (log_file_settings.compress_logs) if (log_file_settings.compress_logs)
{
compressed_buffer.reset(); compressed_buffer.reset();
}
else else
{
chassert(file_buf);
file_buf->finalize();
file_buf.reset(); file_buf.reset();
}
} }
WriteBuffer & getBuffer() WriteBuffer & getBuffer()

View File

@ -43,7 +43,8 @@ namespace
auto from_path = fs::path(path_from); auto from_path = fs::path(path_from);
auto tmp_snapshot_name = from_path.parent_path() / (std::string{tmp_prefix} + from_path.filename().string()); auto tmp_snapshot_name = from_path.parent_path() / (std::string{tmp_prefix} + from_path.filename().string());
{ {
disk_to->writeFile(tmp_snapshot_name); auto buf = disk_to->writeFile(tmp_snapshot_name);
buf->finalize();
} }
disk_from->copyFile(from_path, *disk_to, path_to, {}); disk_from->copyFile(from_path, *disk_to, path_to, {});
disk_to->removeFile(tmp_snapshot_name); disk_to->removeFile(tmp_snapshot_name);
@ -784,7 +785,8 @@ SnapshotFileInfo KeeperSnapshotManager::serializeSnapshotToDisk(const KeeperStor
auto disk = getLatestSnapshotDisk(); auto disk = getLatestSnapshotDisk();
{ {
disk->writeFile(tmp_snapshot_file_name); auto buf = disk->writeFile(tmp_snapshot_file_name);
buf->finalize();
} }
auto writer = disk->writeFile(snapshot_file_name); auto writer = disk->writeFile(snapshot_file_name);