| 35 | } |
| 36 | |
| 37 | void BackupReaderDisk::copyFileToDisk(const String & path_in_backup, size_t file_size, bool encrypted_in_backup, |
| 38 | DiskPtr destination_disk, const String & destination_path, WriteMode write_mode) |
| 39 | { |
| 40 | /// Use IDisk::copyFile() as a more optimal way to copy a file if it's possible. |
| 41 | /// However IDisk::copyFile() can't use throttling for reading, and can't copy an encrypted file or do appending. |
| 42 | bool has_throttling = disk->isRemote() ? static_cast<bool>(read_settings.remote_throttler) : static_cast<bool>(read_settings.local_throttler); |
| 43 | if (!has_throttling && (write_mode == WriteMode::Rewrite) && !encrypted_in_backup) |
| 44 | { |
| 45 | auto destination_data_source_description = destination_disk->getDataSourceDescription(); |
| 46 | if (destination_data_source_description.sameKind(data_source_description) && !data_source_description.is_encrypted) |
| 47 | { |
| 48 | /// Use more optimal way. |
| 49 | LOG_TRACE(log, "Copying file {} from disk {} to disk {}", path_in_backup, disk->getName(), destination_disk->getName()); |
| 50 | disk->copyFile(root_path / path_in_backup, *destination_disk, destination_path, read_settings, write_settings); |
| 51 | return; /// copied! |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | /// Fallback to copy through buffers. |
| 56 | BackupReaderDefault::copyFileToDisk(path_in_backup, file_size, encrypted_in_backup, destination_disk, destination_path, write_mode); |
| 57 | } |
| 58 | |
| 59 | |
| 60 | BackupWriterDisk::BackupWriterDisk(const DiskPtr & disk_, const String & root_path_, const ReadSettings & read_settings_, const WriteSettings & write_settings_) |
nothing calls this directly
no test coverage detected