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

Improve differences between generated mysql service id values #1293

Merged
merged 1 commit into from
Mar 31, 2020

Conversation

ryaner
Copy link
Contributor

@ryaner ryaner commented Mar 27, 2020

This uses the entire mac address then reduces the value to the
acceptable range for mysql.

@ryaner ryaner requested a review from a team as a code owner March 27, 2020 16:37
@ryaner
Copy link
Contributor Author

ryaner commented Mar 27, 2020

Some additional background on the reasoning. We've hit multiple collisions with nodes getting the same server-id inside of the same replication chains. It has been getting more common as the number of nodes has increased.

Examples using the old function

mac => "02:00:0a:32:78:cb",
server-id = 2834123
mac => "04:fe:0a:32:7a:4b",
server-id = 2834123

mac => "04:FE:0A:32:79:3B"
server-id = 2834043
mac => "02:00:0A:32:78:7B"
server-id = 2834043

The new method is obviously not perfect but using the entire mac int value and filtering down should reduce collisions.

This uses the entire mac address then reduces the value to the
acceptable range for mysql.
@ryaner
Copy link
Contributor Author

ryaner commented Mar 27, 2020

I also ran a test using the old vs new method against 1 million random mac addresses.
Old has 7359 collisions. New has 109 collisions.

@daianamezdrea
Copy link
Contributor

Hello @ryaner, thank you for your contribution! This looks good !

@daianamezdrea daianamezdrea merged commit fff2c82 into puppetlabs:master Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants