mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
2 bugfixes:
- Bug #985: "Between RESET SLAVE and START SLAVE, SHOW SLAVE STATUS is wrong." Now RESET SLAVE puts correct info in mi->host etc. A new test rpl_reset_slave for that. - Bug #986: "CHANGE MASTER & START SLAVE do not reset error columns in SHOW SLAVE STATUS". Now these reset the errors. mysql-test/r/rpl_loaddata.result: result update. mysql-test/t/rpl_loaddata.test: Test that RESET SLAVE, START SLAVE and CHANGE MASTER all reset Last_slave_error and Last_slave_errno (columns of SHOW SLAVE STATUS). We do it in this test because that's one of tests which have an intentional query error on the slave. sql/slave.cc: As we need TWICE the code to copy command-line options (--master-host etc) to mi (we already had it in init_master_info, but we also need it in RESET SLAVE to fix bug#985), I make a function of this code. And a function to reset Last_slave_error and Last_slave_errno (we need it in CHANGE MASTER, RESET SLAVE, and at the start of the SQL thread). sql/slave.h: declarations for new functions. sql/sql_repl.cc: copy --master-host etc to mi in RESET SLAVE, so that SHOW SLAVE STATUS shows correct information.
This commit is contained in:
@@ -769,12 +769,15 @@ int reset_slave(THD *thd, MASTER_INFO* mi)
|
||||
&errmsg)))
|
||||
goto err;
|
||||
|
||||
//Clear master's log coordinates (only for good display of SHOW SLAVE STATUS)
|
||||
mi->master_log_name[0]= 0;
|
||||
mi->master_log_pos= BIN_LOG_HEADER_SIZE;
|
||||
//Clear the errors displayed by SHOW SLAVE STATUS
|
||||
mi->rli.last_slave_error[0]=0;
|
||||
mi->rli.last_slave_errno=0;
|
||||
/*
|
||||
Clear master's log coordinates and reset host/user/etc to the values
|
||||
specified in mysqld's options (only for good display of SHOW SLAVE STATUS;
|
||||
next init_master_info() (in start_slave() for example) would have set them
|
||||
the same way; but here this is for the case where the user does SHOW SLAVE
|
||||
STATUS; before doing START SLAVE;
|
||||
*/
|
||||
init_master_info_with_options(mi);
|
||||
clear_last_slave_error(&mi->rli);
|
||||
//close master_info_file, relay_log_info_file, set mi->inited=rli->inited=0
|
||||
end_master_info(mi);
|
||||
//and delete these two files
|
||||
@@ -965,6 +968,8 @@ int change_master(THD* thd, MASTER_INFO* mi)
|
||||
|
||||
pthread_mutex_lock(&mi->rli.data_lock);
|
||||
mi->rli.abort_pos_wait++; /* for MASTER_POS_WAIT() to abort */
|
||||
/* Clear the error, for a clean start. */
|
||||
clear_last_slave_error(&mi->rli);
|
||||
/*
|
||||
If we don't write new coordinates to disk now, then old will remain in
|
||||
relay-log.info until START SLAVE is issued; but if mysqld is shutdown
|
||||
|
Reference in New Issue
Block a user