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

Change in GET_LOCK call to make it MariaDB compatilble #5343

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion physical/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ func (i *MySQLLock) becomeLeader() error {
func (i *MySQLLock) Lock() error {
defer metrics.MeasureSince([]string{"mysql", "get_lock"}, time.Now())

rows, err := i.in.Query("SELECT GET_LOCK(?, -1), IS_USED_LOCK(?)", i.key, i.key)
rows, err := i.in.Query("SELECT GET_LOCK(?, 4294967295), IS_USED_LOCK(?)", i.key, i.key)
Copy link
Member

Choose a reason for hiding this comment

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

How was this number chosen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This number is the decimal representation of maximal integer with 64bit length. In hexadecimal this number should be 0xffffffff

Copy link
Contributor

@michaeljs1990 michaeljs1990 Sep 18, 2018

Choose a reason for hiding this comment

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

Can we instead use math.MaxUint32 from the https://golang.org/pkg/math/ package and add a comment above that about -1 not being compatible with different MySQL flavours?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@michaeljs1990 Yes, we can use this constant. I tested this, committed changes and comments.

Choose a reason for hiding this comment

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

Same problem faced. Can you help with steps on how to apply this fix on a running mysql deployment?

Copy link
Contributor

Choose a reason for hiding this comment

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

You shouldn't need to make any changes to mysql for this fix. What is the issue you are running into?

if err != nil {
return err
}
Expand Down