| 127 | } |
| 128 | |
| 129 | void BackupWriterDisk::copyFileFromDisk( |
| 130 | const String & path_in_backup, DiskPtr src_disk, const String & src_path, bool copy_encrypted, UInt64 start_pos, UInt64 length) |
| 131 | { |
| 132 | /// Use IDisk::copyFile() as a more optimal way to copy a file if it's possible. |
| 133 | /// However IDisk::copyFile() can't use throttling for reading, and can't copy an encrypted file or copy a part of the file. |
| 134 | bool has_throttling = src_disk->isRemote() ? static_cast<bool>(read_settings.remote_throttler) : static_cast<bool>(read_settings.local_throttler); |
| 135 | if (!has_throttling && !start_pos && !copy_encrypted) |
| 136 | { |
| 137 | auto source_data_source_description = src_disk->getDataSourceDescription(); |
| 138 | if (source_data_source_description.sameKind(data_source_description) && !source_data_source_description.is_encrypted |
| 139 | && (length == src_disk->getFileSize(src_path))) |
| 140 | { |
| 141 | /// Use more optimal way. |
| 142 | LOG_TRACE(log, "Copying file {} from disk {} to disk {}", src_path, src_disk->getName(), disk->getName()); |
| 143 | auto dest_file_path = root_path / path_in_backup; |
| 144 | disk->createDirectories(dest_file_path.parent_path()); |
| 145 | src_disk->copyFile(src_path, *disk, dest_file_path, read_settings, write_settings); |
| 146 | return; /// copied! |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | /// Fallback to copy through buffers. |
| 151 | BackupWriterDefault::copyFileFromDisk(path_in_backup, src_disk, src_path, copy_encrypted, start_pos, length); |
| 152 | } |
| 153 | |
| 154 | void BackupWriterDisk::copyFile(const String & destination, const String & source, size_t /*size*/) |
| 155 | { |
nothing calls this directly
no test coverage detected