From f51050d2c97039a8c54e5b8d39537e7598be6ff0 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Tue, 8 Oct 2024 13:57:44 +0200 Subject: [PATCH] Ignore only ErrnoException/fs::filesystem_error while moving parts to detached Signed-off-by: Azat Khuzhin --- src/Storages/MergeTree/IMergeTreeDataPart.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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) {