diff --git a/src/Storages/MergeTree/IMergeTreeDataPart.cpp b/src/Storages/MergeTree/IMergeTreeDataPart.cpp index effa8e85665..69a2260d375 100644 --- a/src/Storages/MergeTree/IMergeTreeDataPart.cpp +++ b/src/Storages/MergeTree/IMergeTreeDataPart.cpp @@ -2033,7 +2033,23 @@ void IMergeTreeDataPart::renameToDetached(const String & prefix, bool ignore_err { renameTo(path_to_detach.value(), true); } - catch (...) + /// This exceptions majority of cases: + /// - fsync + /// - mtime adjustment + catch (const ErrnoException &) + { + if (ignore_error) + { + // Don't throw when the destination is to the detached folder. It might be able to + // recover in some cases, such as fetching parts into multi-disks while some of the + // disks are broken. + tryLogCurrentException(__PRETTY_FUNCTION__); + } + else + throw; + } + /// - rename + catch (const fs::filesystem_error &) { if (ignore_error) {