Skip to content

Improve differences between generated mysql service id values#1293

Merged
daianamezdrea merged 1 commit intopuppetlabs:masterfrom
ryaner:master
Mar 31, 2020
Merged

Improve differences between generated mysql service id values#1293
daianamezdrea merged 1 commit intopuppetlabs:masterfrom
ryaner:master

Conversation

@ryaner
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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