Skip to content

meta/sql: fix flush quotas deadlock #5706

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

Merged
merged 1 commit into from
Mar 4, 2025
Merged

meta/sql: fix flush quotas deadlock #5706

merged 1 commit into from
Mar 4, 2025

Conversation

jiefenghuang
Copy link
Contributor

@jiefenghuang jiefenghuang commented Feb 28, 2025

close #5695

@davies davies added this to the Release 1.3 milestone Mar 3, 2025
Signed-off-by: jiefenghuang <jiefeng@juicedata.io>
@@ -3526,11 +3526,12 @@ func (m *dbMeta) doLoadQuotas(ctx Context) (map[Ino]*Quota, error) {
return quotas, nil
}

func (m *dbMeta) doFlushQuotas(ctx Context, quotas map[Ino]*Quota) error {
func (m *dbMeta) doFlushQuotas(ctx Context, quotas []*iQuota) error {
sort.Slice(quotas, func(i, j int) bool { return quotas[i].inode < quotas[j].inode })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is sorting for sql enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redis and kv do not have such issues; key sorting may improve performance for kv, but it increases the overhead on the client side.

@davies davies merged commit f9bd33e into main Mar 4, 2025
35 checks passed
@davies davies deleted the fix-quota branch March 4, 2025 02:02
@anysql
Copy link
Contributor

anysql commented Apr 1, 2025

community user feedback: "Deadlock issue is fixed now!!!"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deadlock in a Loop During High-Concurrency File Updates
3 participants