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

use a hash for metadata lock name #357

Merged
merged 3 commits into from
Dec 3, 2024
Merged

Conversation

kolbe
Copy link
Collaborator

@kolbe kolbe commented Dec 3, 2024

Previously, metadata locks would conflict across same-named tables in different schemas. This PR fixes that issue by using a combination of schema name, table name, and a hash value for the metadata lock name.

if err = getLock(); err != nil {
return nil, err
}
logger.Infof("acquired metadata lock: %s", lockName)
logger.Infof("acquired metadata lock: %s.%s", table.SchemaName, table.TableName)
Copy link
Collaborator

Choose a reason for hiding this comment

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

May be worth logging lockName too in one of the logs somewhere

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's not easy to do that, because I'm computing the lock name server-side inside the GET_LOCK function call. So for now let's leave it like this and if in the future we have a real need to log the lock name, I think we could just add another MySQL round-trip to compute the lock name and then use it in GET_LOCK.

@kolbe kolbe merged commit 1d7524e into cashapp:main Dec 3, 2024
11 checks passed
@kolbe kolbe deleted the lock-name-hash branch December 3, 2024 20:14
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.

2 participants