From fa7ed076d4453b91b6a50160e8a31ecd726550f4 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Jul 2005 19:08:01 -0600 Subject: [PATCH 1/3] patch for bug 10780 sql/slave.cc: bug 10780 sql/slave.h: bug 10780 mysql-test/r/rpl_slave_status.result: New BitKeeper file ``mysql-test/r/rpl_slave_status.result'' --- mysql-test/r/rpl_slave_status.result | 23 +++++++++++++++++++++++ sql/slave.cc | 5 +++-- sql/slave.h | 1 + 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 mysql-test/r/rpl_slave_status.result diff --git a/mysql-test/r/rpl_slave_status.result b/mysql-test/r/rpl_slave_status.result new file mode 100644 index 00000000000..4eb2e87d221 --- /dev/null +++ b/mysql-test/r/rpl_slave_status.result @@ -0,0 +1,23 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl'; +stop slave; +change master to master_user='rpl',master_password='rpl'; +start slave; +drop table if exists t1; +create table t1 (n int); +insert into t1 values (1); +select * from t1; +n +1 +delete from mysql.user where user='rpl'; +flush privileges; +stop slave; +start slave; +show slave status; +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master +Connecting to master 127.0.0.1 rpl MASTER_MYPORT 1 master-bin.000001 357 slave-relay-bin.000001 401 master-bin.000001 No Yes 0 0 357 401 None 0 No NULL diff --git a/sql/slave.cc b/sql/slave.cc index f25ad90487a..286bb07e4c9 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2186,7 +2186,8 @@ int show_master_info(THD* thd, MASTER_INFO* mi) &my_charset_bin); protocol->store((ulonglong) mi->rli.group_relay_log_pos); protocol->store(mi->rli.group_master_log_name, &my_charset_bin); - protocol->store(mi->slave_running ? "Yes":"No", &my_charset_bin); + protocol->store(mi->slave_running == MYSQL_SLAVE_RUN_CONNECT + ? "Yes":"No", &my_charset_bin); protocol->store(mi->rli.slave_running ? "Yes":"No", &my_charset_bin); protocol->store(&replicate_do_db); protocol->store(&replicate_ignore_db); @@ -3078,7 +3079,7 @@ slave_begin: pthread_mutex_lock(&LOCK_thread_count); threads.append(thd); pthread_mutex_unlock(&LOCK_thread_count); - mi->slave_running = 1; + mi->slave_running = MYSQL_SLAVE_RUN_INIT; mi->abort_slave = 0; pthread_mutex_unlock(&mi->run_lock); pthread_cond_broadcast(&mi->start_cond); diff --git a/sql/slave.h b/sql/slave.h index 5a85e26d9ad..6aa61c3a7e4 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -112,6 +112,7 @@ enum enum_binlog_formats { #define MYSQL_SLAVE_NOT_RUN 0 #define MYSQL_SLAVE_RUN_NOT_CONNECT 1 #define MYSQL_SLAVE_RUN_CONNECT 2 +#define MYSQL_SLAVE_RUN_INIT 3 /**************************************************************************** From 26547b33c3ab9d05e59a3255785387dd3d30426f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Jul 2005 19:10:49 -0600 Subject: [PATCH 2/3] testcase for bug 10780 was not added in the previous commit mysql-test/t/rpl_slave_status.test: New BitKeeper file ``mysql-test/t/rpl_slave_status.test'' --- mysql-test/t/rpl_slave_status.test | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 mysql-test/t/rpl_slave_status.test diff --git a/mysql-test/t/rpl_slave_status.test b/mysql-test/t/rpl_slave_status.test new file mode 100644 index 00000000000..6bccf6fd341 --- /dev/null +++ b/mysql-test/t/rpl_slave_status.test @@ -0,0 +1,28 @@ +# Test case for BUG #10780 +source include/master-slave.inc +connection master; +grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl'; +connection slave; +stop slave; +change master to master_user='rpl',master_password='rpl'; +start slave; +connection master; +--disable_warnings +drop table if exists t1; +--enable_warning +create table t1 (n int); +insert into t1 values (1); +save_master_pos; +connection slave; +sync_with_master; +select * from t1; +connection master; +delete from mysql.user where user='rpl'; +flush privileges; +connection slave; +stop slave; +start slave; +--replace_result $MASTER_MYPORT MASTER_MYPORT +show slave status; + +# end of 4.1 tests From 63e9a87af7323e7f9c46813caadafe31a3a17d6e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 29 Jul 2005 21:00:28 -0600 Subject: [PATCH 3/3] updates for BUG#10780 - fixed slave I/O thread running status to No while attempting to connect mysql-test/r/rpl_slave_status.result: updated result mysql-test/t/rpl_slave_status.test: user vertical result sql/slave.cc: reversed an unnecessary change for BUG#10780 sql/slave.h: reversed an unnecessary change for BUG#10780 --- mysql-test/r/rpl_slave_status.result | 35 ++++++++++++++++++++++++++-- mysql-test/t/rpl_slave_status.test | 1 + sql/slave.cc | 2 +- sql/slave.h | 1 - 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/rpl_slave_status.result b/mysql-test/r/rpl_slave_status.result index 4eb2e87d221..5e9b6ab31ad 100644 --- a/mysql-test/r/rpl_slave_status.result +++ b/mysql-test/r/rpl_slave_status.result @@ -19,5 +19,36 @@ flush privileges; stop slave; start slave; show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -Connecting to master 127.0.0.1 rpl MASTER_MYPORT 1 master-bin.000001 357 slave-relay-bin.000001 401 master-bin.000001 No Yes 0 0 357 401 None 0 No NULL +Slave_IO_State Connecting to master +Master_Host 127.0.0.1 +Master_User rpl +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 357 +Relay_Log_File slave-relay-bin.000001 +Relay_Log_Pos 401 +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running No +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 357 +Relay_Log_Space 401 +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master NULL diff --git a/mysql-test/t/rpl_slave_status.test b/mysql-test/t/rpl_slave_status.test index 6bccf6fd341..4e0d7dae35c 100644 --- a/mysql-test/t/rpl_slave_status.test +++ b/mysql-test/t/rpl_slave_status.test @@ -23,6 +23,7 @@ connection slave; stop slave; start slave; --replace_result $MASTER_MYPORT MASTER_MYPORT +--vertical_results show slave status; # end of 4.1 tests diff --git a/sql/slave.cc b/sql/slave.cc index 286bb07e4c9..a0cc773d44f 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3079,7 +3079,7 @@ slave_begin: pthread_mutex_lock(&LOCK_thread_count); threads.append(thd); pthread_mutex_unlock(&LOCK_thread_count); - mi->slave_running = MYSQL_SLAVE_RUN_INIT; + mi->slave_running = 1; mi->abort_slave = 0; pthread_mutex_unlock(&mi->run_lock); pthread_cond_broadcast(&mi->start_cond); diff --git a/sql/slave.h b/sql/slave.h index 6aa61c3a7e4..5a85e26d9ad 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -112,7 +112,6 @@ enum enum_binlog_formats { #define MYSQL_SLAVE_NOT_RUN 0 #define MYSQL_SLAVE_RUN_NOT_CONNECT 1 #define MYSQL_SLAVE_RUN_CONNECT 2 -#define MYSQL_SLAVE_RUN_INIT 3 /****************************************************************************