Try fix 'Directory tmp_merge_<part_name>' already exists#32201
Try fix 'Directory tmp_merge_<part_name>' already exists#32201
Conversation
|
Wow, my favorite method changed. |
|
Integration tests (asan, actions) - |
| } | ||
| if (parent_part) | ||
| { | ||
| std::optional<bool> keep_shared_data = keepSharedDataInDecoupledStorage(); |
| if (parent_part) | ||
| { | ||
| std::optional<bool> keep_shared_data = keepSharedDataInDecoupledStorage(); | ||
| if (!keep_shared_data.has_value()) |
There was a problem hiding this comment.
I failed to understand the logic around force_keep_shared_data
|
|
||
| part = get_part(); | ||
| // The fetched part is valuable and should not be cleaned like a temp part. | ||
| part->is_temp = false; |
There was a problem hiding this comment.
Probably we shouldn't remove this.
|
@Mergifyio update |
✅ Branch has been successfully updated |
I think it might caused by system freezing, and the |
Backport #32201 to 21.12: Try fix 'Directory tmp_merge_<part_name>' already exists
Backport #32201 to 21.10: Try fix 'Directory tmp_merge_<part_name>' already exists
Backport #32201 to 21.9: Try fix 'Directory tmp_merge_<part_name>' already exists
Backport #32201 to 21.11: Try fix 'Directory tmp_merge_<part_name>' already exists
Backport #32201 to 21.8: Try fix 'Directory tmp_merge_<part_name>' already exists
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Some replication queue entries might hang for
temporary_directories_lifetime(1 day by default) withDirectory tmp_merge_<part_name>orPart ... (state Deleting) already exists, but it will be deleted soonor similar error. It's fixed. Fixes #29616.Detailed description / Documentation draft:
Probably fixes #31843.
It happens because of race condition on part removal:
Outdated(withis_temp == false, directory name is just part name), cleanup thread will try to remove it.is_temp == trueand directory nametmp_merge_<part_name>), but fails to add it it active set due toPart ... (state Deleting) already existstmp_delete_<part_name>, because directory exists, because cleanup thread is removingOutdatedpart with the same name.tmp_merge_<part_name>directory on disk, nobody (exceptclearOldTemporaryDirectories) will retry removal, because part is temporary andMergeTreeDataPartobject does exist anymore.Probably we should refactor parts removal mechanism, because it has became quite complex and fragile with all the flags (
is_temp,keep_shared_data,force_keep_shared_data), special states (DeleteOnDestroy),IDiskinterface and projections.