mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Code review fixes.
This commit is contained in:
parent
7c0a1b9451
commit
a92cf30b67
@ -209,7 +209,13 @@ void DiskCacheWrapper::clearDirectory(const String & path)
|
||||
void DiskCacheWrapper::moveDirectory(const String & from_path, const String & to_path)
|
||||
{
|
||||
if (cache_disk->exists(from_path))
|
||||
{
|
||||
/// Destination directory may not be empty if previous directory move attempt was failed.
|
||||
if (cache_disk->exists(to_path) && cache_disk->isDirectory(to_path))
|
||||
cache_disk->clearDirectory(to_path);
|
||||
|
||||
cache_disk->moveDirectory(from_path, to_path);
|
||||
}
|
||||
DiskDecorator::moveDirectory(from_path, to_path);
|
||||
}
|
||||
|
||||
@ -217,9 +223,6 @@ void DiskCacheWrapper::moveFile(const String & from_path, const String & to_path
|
||||
{
|
||||
if (cache_disk->exists(from_path))
|
||||
{
|
||||
if (cache_disk->exists(to_path) && cache_disk->isDirectory(to_path))
|
||||
cache_disk->clearDirectory(to_path);
|
||||
|
||||
auto dir_path = directoryPath(to_path);
|
||||
if (!cache_disk->exists(dir_path))
|
||||
cache_disk->createDirectories(dir_path);
|
||||
|
@ -1013,7 +1013,7 @@ void IMergeTreeDataPart::renameTo(const String & new_relative_path, bool remove_
|
||||
}
|
||||
|
||||
volume->getDisk()->setLastModified(from, Poco::Timestamp::fromEpochTime(time(nullptr)));
|
||||
volume->getDisk()->moveFile(from, to);
|
||||
volume->getDisk()->moveDirectory(from, to);
|
||||
relative_path = new_relative_path;
|
||||
|
||||
SyncGuardPtr sync_guard;
|
||||
@ -1065,7 +1065,7 @@ void IMergeTreeDataPart::remove(bool keep_s3) const
|
||||
|
||||
try
|
||||
{
|
||||
volume->getDisk()->moveFile(from, to);
|
||||
volume->getDisk()->moveDirectory(from, to);
|
||||
}
|
||||
catch (const Poco::FileNotFoundException &)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user