-
Tiago Jorge authored
BUT REPLICATION FAILS Problem: When one enables binary logging without setting a server id, letting it default to 0, the server changes it to 1, but replication does not work. According to the documentation, a server id > 0, should be a legal configuration to allow slave to connect and replication to work. Analysis: Apparently, this happens since the dawn of time as a design decision, meaning that binlog => server_id. In mysqld.cc::main() [...] if (opt_bin_log && server_id == 0) { server_id= 1; #ifdef EXTRA_DEBUG sql_print_warning("You have enabled the binary log, but you haven't set " "server-id to a non-zero value: we force server id to 1; " "updates will be logged to the binary log, but " "connections from slaves will not be accepted."); #endif } [...] What happened is that, when a slave tried to connect, it would get an error stating that the master was misconfigured, even with server-id = 1. After some testing we concluded that not even the documentation was accurate enough. The test conducted were: 1) Start master with no options. Make sure that slave cannot connect (control experience) 2) Start master with only binlog active. Make sure that slave cannot connect (the bug situation) 3) Start master with binlog active and server-id == 0 in the command line. Make sure that slave cannot connect. (as documented) 4) Start master with binlog active and server-id == 1 in the command line. Change server_id to 0 using SQL before connecting slave. Make sure that slave cannot connect.(as documented) Situations 1) and 2) are OK and according with expected and analyzed behavior. With 3) and 4) things are not as documented. In Situation 3) the server starts and implicitly sets server id to 1. When one starts a slave after configuring the master, there is no error in "SHOW SLAVE STATUS". It connects and works. Bin and Relay log have a server id of 1. In Situation 4) in which one explicitly change the server_id in runtime, the behavior is the same as in Situation 3). Contents of the relay log and bin log have a server id == 0 Fix: For trunk only the decision was: - Server_id must be explicitly set if binlog is active. If not, the server will not start. - if you set server_id=0, no slaves can connect, but your statements will be binlogged with the provided server_id. - if no server_id is set, it will have the default configured value and have the same behaviour as the above, if the default is 0. This patch will bring the code closer to which is documented. The dynamic change of server-id was not addressed here. For the previous version, one thinks that the documentation should be augmented according to the information detailed in the bug page.
Tiago Jorge authoredBUT REPLICATION FAILS Problem: When one enables binary logging without setting a server id, letting it default to 0, the server changes it to 1, but replication does not work. According to the documentation, a server id > 0, should be a legal configuration to allow slave to connect and replication to work. Analysis: Apparently, this happens since the dawn of time as a design decision, meaning that binlog => server_id. In mysqld.cc::main() [...] if (opt_bin_log && server_id == 0) { server_id= 1; #ifdef EXTRA_DEBUG sql_print_warning("You have enabled the binary log, but you haven't set " "server-id to a non-zero value: we force server id to 1; " "updates will be logged to the binary log, but " "connections from slaves will not be accepted."); #endif } [...] What happened is that, when a slave tried to connect, it would get an error stating that the master was misconfigured, even with server-id = 1. After some testing we concluded that not even the documentation was accurate enough. The test conducted were: 1) Start master with no options. Make sure that slave cannot connect (control experience) 2) Start master with only binlog active. Make sure that slave cannot connect (the bug situation) 3) Start master with binlog active and server-id == 0 in the command line. Make sure that slave cannot connect. (as documented) 4) Start master with binlog active and server-id == 1 in the command line. Change server_id to 0 using SQL before connecting slave. Make sure that slave cannot connect.(as documented) Situations 1) and 2) are OK and according with expected and analyzed behavior. With 3) and 4) things are not as documented. In Situation 3) the server starts and implicitly sets server id to 1. When one starts a slave after configuring the master, there is no error in "SHOW SLAVE STATUS". It connects and works. Bin and Relay log have a server id of 1. In Situation 4) in which one explicitly change the server_id in runtime, the behavior is the same as in Situation 3). Contents of the relay log and bin log have a server id == 0 Fix: For trunk only the decision was: - Server_id must be explicitly set if binlog is active. If not, the server will not start. - if you set server_id=0, no slaves can connect, but your statements will be binlogged with the provided server_id. - if no server_id is set, it will have the default configured value and have the same behaviour as the above, if the default is 0. This patch will bring the code closer to which is documented. The dynamic change of server-id was not addressed here. For the previous version, one thinks that the documentation should be augmented according to the information detailed in the bug page.
Loading