-
Notifications
You must be signed in to change notification settings - Fork 687
random server_id as default to avoid conflict #80
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
Conversation
Perhaps we can detect if someone use this id and use an empty: |
I totaly agree this is an issue and we should fix it if user doesn't provide a server_id |
I don't like this. The user should provide the server id and we should not take care of it. |
I think if we want the user to provide a server_id, it should be args without default value and let the user know it. If it has a default value, we should make it right. In this case, user who do not read source code won't know about it, and will come across very strange problems when running multiple daemons. We used some very tricky hacks to bypass the conflict problem until I realize it's because of the same server_id... = =# |
you are right, than we should possible remove the default value. |
So what's the final thoughts here? currently we have 2 directions:
I still think 1 is the way to go, since most users don't need to worry about server_id and it seems have no side-effects, while if we choose 2, it may break some existing scripts. |
I have another suggestion:
server_id = "auto" can do the job but 'm not a big fan of having to kind of type in the same value |
What did you think about that? |
I still think that removing the default value should be the way to go. Users relying on the old behaviour just have to provide an value and users which need random server_ids can provide them. There are no many different replication setups out there, that I think trying to provide a smart algorithm to guess a good value for all users will he very hard. So just not trying would be the easist thing. :) |
I'm ok with removing the default value, it's better than the current explicit value. For the 'auto' part, do you like the idea to accept a callable for server_id? for example: self.__server_id = server_id() if callable(server_id) else server_id |
I'm not sure if callable is not too magic from outside point of views. |
connection_settings was also changed to arg since it's essential and kwargs default value should not be mutable.
alright, I'll open another pull request to only remove the server_id default value then. |
remove default server_id as discussed in #80
The 255 server_id as default easy conflicted each other when multiple binlog streams started following the same server.
Use as random int with high value range to minimize the conflict possibility.