Merge pull request #41190 from kssenii/fix-clean-up-thread

Fix cleaning up broken detached part after timeout
This commit is contained in:
Kseniia Sumarokova 2022-09-12 13:21:45 +02:00 committed by GitHub
commit df22e8d30c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -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();

View File

@ -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)