From 02c3d8b0a07f62b961e9b75bb054f0840aabafec Mon Sep 17 00:00:00 2001 From: kssenii Date: Sun, 11 Sep 2022 15:48:22 +0200 Subject: [PATCH] Fix --- src/Storages/MergeTree/MergeTreeData.cpp | 3 ++- tests/integration/test_broken_detached_part_clean_up/test.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Storages/MergeTree/MergeTreeData.cpp b/src/Storages/MergeTree/MergeTreeData.cpp index 78821ffcb74..42e1a893f96 100644 --- a/src/Storages/MergeTree/MergeTreeData.cpp +++ b/src/Storages/MergeTree/MergeTreeData.cpp @@ -1990,10 +1990,11 @@ size_t MergeTreeData::clearOldBrokenPartsFromDetachedDirectory() renamed_parts.tryRenameAll(); - for (const auto & [old_name, new_name, disk] : renamed_parts.old_and_new_names) + for (auto & [old_name, new_name, disk] : renamed_parts.old_and_new_names) { removeDetachedPart(disk, fs::path(relative_data_path) / "detached" / new_name / "", old_name, false); LOG_DEBUG(log, "Removed broken detached part {} due to a timeout for broken detached parts", old_name); + old_name.clear(); } return renamed_parts.old_and_new_names.size(); diff --git a/tests/integration/test_broken_detached_part_clean_up/test.py b/tests/integration/test_broken_detached_part_clean_up/test.py index 1321778f2ca..e9ef0067ca5 100644 --- a/tests/integration/test_broken_detached_part_clean_up/test.py +++ b/tests/integration/test_broken_detached_part_clean_up/test.py @@ -96,6 +96,9 @@ def remove_broken_detached_part_impl(table, node, expect_broken_prefix): assert "unexpected_all_42_1337_5" in result time.sleep(15) + assert node.contains_in_log( + "Removed broken detached part unexpected_all_42_1337_5 due to a timeout" + ) result = node.exec_in_container(["ls", path_to_detached]) print(result)