Bug #33432 reset slave behavior is odd
Submitted: 21 Dec 2007 4:04 Modified: 24 Dec 2007 15:06
Reporter: Mark Callaghan Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S4 (Feature request)
Version:5.0.37 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: replication, reset, slave

[21 Dec 2007 4:04] Mark Callaghan
Description:
The behavior of RESET SLAVE is odd. It removes relay log files, relay-log.info and master.info. It creates an empty relay log file and the edits HOST-relay-bin.index to only list the new relay log file. After this is run, SHOW SLAVE STATUS returns a result as if the server were configured to be a slave.

Why does this create an empty relay log file? The server is no longer configured to be a slave, the file is useless. Its presence may mislead a DBA to think that the server is a slave.

Why does SHOW SLAVE STATUS return a result after RESET SLAVE is run? The server is not a slave. If the server is rebooted after RESET SLAVE, SHOW SLAVE STATUS returns nothing as expected for something not setup to be a slave.

And please, don't suggest CHANGE MASTER MASTER_HOST="" as the best way to do this. CHANGE MASTER is already overloaded way too much and this particular behavior for CHANGE MASTER is not documented.

How to repeat:
CHANGE MASTER ... (to setup a slave)
RESET SLAVE;
SHOW SLAVE STATUS;

Suggested fix:
Don't create an empty relay log file during RESET SLAVE.
Don't reference this file from HOST-relay-bin.index during RESET SLAVE.
Make SHOW SLAVE STATUS return nothing after RESET SLAVE.
[24 Dec 2007 15:06] Valeriy Kravchuk
Thank you for a reasonable feature request.