Bug #77086 RESET SLAVE ALL behaves different for default and non-default channels
Submitted: 19 May 2015 8:21 Modified: 8 Jul 2015 12:31
Reporter: Sven Sandberg Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[19 May 2015 8:21] Sven Sandberg
Description:
For non-default channels, RESET SLAVE ALL removes the channel completely, thus resets all associated configuration and status.

For the default channel, RESET SLAVE ALL does not remove the channel, so some configuration and status is retained: see e.g. BUG#21107331.

How to repeat:
See BUG#21107331

Suggested fix:
The problematic code is this:

int reset_slave(THD *thd, Master_info* mi, bool reset_all)
{

  [...]

  /*
     delete the channel if reset_slave_info.all is set,
     except the default channel
  */
  if (!error && reset_all &&
      strcmp(mi->get_channel(), msr_map.get_default_channel()))
  {
    error= delete_slave_info_object(mi);
  }

It would be better to do something like:

  if (!error && reset_all)
  {
    error= delete_slave_info_object(mi);
    if (!error && strcmp(mi->get_channel(), msr_map.get_default_channel()) == 0)
      error= create_slave_info_object();
  }

Then we can also get rid of mi->clear_in_memory_info().
[8 Jul 2015 12:31] David Moss
Posted by developer:
 
The following was noted in the 5.7.8 changelog:
Issuing RESET SLAVE on the default replication channel does not remove the channel, as it always exists. This meant that the default replication channel did not correctly reset some configuration and status parameters.
[9 Jul 2015 9:16] David Moss
Posted by developer:
 
After review with Sven, this 5.7.8 changelog entry was updated to:
When using multiple replication channels, issuing RESET SLAVE on a non-default replication channel removes the channel, whereas issuing RESET SLAVE on the default replication channel does not remove the channel, as it always exists. In previous versions, this meant that the default replication channel did not correctly reset some configuration and status parameters. The fix ensures that issuing RESET SLAVE on the default replication channel resets all parameters.