mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
fix build check and make rename robust in DiskS3::restoreFileOperations
This commit is contained in:
parent
f7078a17ce
commit
4366fcbc83
@ -106,11 +106,11 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class DiskLocalDirectoryIterator : public IDiskDirectoryIterator
|
||||
class DiskLocalDirectoryIterator final : public IDiskDirectoryIterator
|
||||
{
|
||||
public:
|
||||
DiskLocalDirectoryIterator() {}
|
||||
explicit DiskLocalDirectoryIterator(const String & disk_path_, const String & dir_path_)
|
||||
DiskLocalDirectoryIterator() { }
|
||||
DiskLocalDirectoryIterator(const String & disk_path_, const String & dir_path_)
|
||||
: dir_path(dir_path_), entry(fs::path(disk_path_) / dir_path_)
|
||||
{
|
||||
}
|
||||
|
@ -1002,6 +1002,10 @@ void DiskS3::restoreFileOperations(const RestoreInformation & restore_informatio
|
||||
else
|
||||
to_path /= from_path.filename();
|
||||
|
||||
/// to_path may exist and non-empty in case for example abrupt restart, so remove it before rename
|
||||
if (metadata_disk->exists(to_path))
|
||||
metadata_disk->removeRecursive(to_path);
|
||||
|
||||
metadata_disk->moveDirectory(from_path, to_path);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user