-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Try fix 'Directory tmp_merge_<part_name>' already exists #32201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Wow, my favorite method changed. |
|
Integration tests (asan, actions) - |
| } | ||
| if (parent_part) | ||
| { | ||
| std::optional<bool> keep_shared_data = keepSharedDataInDecoupledStorage(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obscure code for me, but Ok.
| if (parent_part) | ||
| { | ||
| std::optional<bool> keep_shared_data = keepSharedDataInDecoupledStorage(); | ||
| if (!keep_shared_data.has_value()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it mean....?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.