#At file:///home/ngb/mysql/bzr/bug30703-6.0-bugteam/
3101 Guangbao Ni 2009-03-04
Bug #30703 SHOW STATUS LIKE 'Slave_running' is not compatible with `SHOW SLAVE STATUS'
SHOW SHOW STATUS LIKE 'Slave_running' command believes that
if active_mi->slave_running != 0, then io thread is running normally.
But it isn't so in fact. When some errors happen to make io thread
try to reconnect master, then it will become transitional status
(MYSQL_SLAVE_RUN_NOT_CONNECT == 1), which also doesn't equal 0.
Yet, "SHOW SLAVE STATUS" believes that only if
active_mi->slave_running == MYSQL_SLAVE_RUN_CONNECT, then io thread is running.
So "SHOW SLAVE STATUS" can get the correct result.
Fixed to make SHOW SHOW STATUS LIKE 'Slave_running' command have the same check condition
with "SHOW SLAVE STATUS". It only believe that the io thread is running
when active_mi->slave_running == MYSQL_SLAVE_RUN_CONNECT.
modified:
sql/mysqld.cc
per-file messages:
sql/mysqld.cc
Fixed to make SHOW SHOW STATUS LIKE 'Slave_running' command have the same check condition
with "SHOW SLAVE STATUS". It only believe that the io thread is running
when active_mi->slave_running == MYSQL_SLAVE_RUN_CONNECT.
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2009-02-25 08:58:28 +0000
+++ b/sql/mysqld.cc 2009-03-04 17:28:42 +0000
@@ -7369,7 +7369,8 @@ static int show_slave_running(THD *thd,
var->type= SHOW_MY_BOOL;
pthread_mutex_lock(&LOCK_active_mi);
var->value= buff;
- *((my_bool *)buff)= (my_bool) (active_mi && active_mi->slave_running &&
+ *((my_bool *)buff)= (my_bool) (active_mi &&
+ active_mi->slave_running == MYSQL_SLAVE_RUN_CONNECT &&
active_mi->rli.slave_running);
pthread_mutex_unlock(&LOCK_active_mi);
return 0;