Skip to content
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

meta/sql: remove lock on edge to avoid deadlock #3677

Merged
merged 1 commit into from
May 26, 2023
Merged

Conversation

davies
Copy link
Contributor

@davies davies commented May 24, 2023

When MySQL is used as meta engine, the lock on edge is a gap lock, which can overlap with other directories, can cause deadlock.

Since we always lock the parent directory, so the lock for edge is useless, remove them to avoid deadlock.

Some lock on child node is also removed, since the update of some column is atomic or already protected by the lock of parent dir.

There is still a chance to deadlock in rename, because we have to lock the target sub-directory (for overwrite), which could be locked first by other rename. We left this for database to detect it and retry the transactions.

close #3665

@davies davies changed the title remove lock on edge to avoid deadlock meta/sql: remove lock on edge to avoid deadlock May 24, 2023
@davies davies requested a review from SandyXSD May 25, 2023 01:50
@davies davies added backport-1.0 Backport to release-1.0 branch and removed backport-1.0 Backport to release-1.0 branch labels May 26, 2023
@davies davies merged commit 3ef58b4 into main May 26, 2023
@davies davies deleted the reduce_sql_lock branch May 26, 2023 01:56
SandyXSD pushed a commit that referenced this pull request Aug 23, 2023
SandyXSD pushed a commit that referenced this pull request Aug 31, 2023
davies added a commit that referenced this pull request Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deadlock error when create file or mkdir
2 participants