mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Merge pull request #23433 from ClickHouse/tavplubix-patch-1
Fix `Cannot unlink file` in `dropIfEmpty()` with multidisk confuguration
This commit is contained in:
commit
c66e715f49
@ -1391,12 +1391,20 @@ void MergeTreeData::dropIfEmpty()
|
||||
if (!data_parts_by_info.empty())
|
||||
return;
|
||||
|
||||
for (const auto & [path, disk] : getRelativeDataPathsWithDisks())
|
||||
try
|
||||
{
|
||||
/// Non recursive, exception is thrown if there are more files.
|
||||
disk->removeFile(path + MergeTreeData::FORMAT_VERSION_FILE_NAME);
|
||||
disk->removeDirectory(path + MergeTreeData::DETACHED_DIR_NAME);
|
||||
disk->removeDirectory(path);
|
||||
for (const auto & [path, disk] : getRelativeDataPathsWithDisks())
|
||||
{
|
||||
/// Non recursive, exception is thrown if there are more files.
|
||||
disk->removeFileIfExists(path + MergeTreeData::FORMAT_VERSION_FILE_NAME);
|
||||
disk->removeDirectory(path + MergeTreeData::DETACHED_DIR_NAME);
|
||||
disk->removeDirectory(path);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// On unsuccessful creation of ReplicatedMergeTree table with multidisk configuration some files may not exist.
|
||||
tryLogCurrentException(__PRETTY_FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user