diff options
-rw-r--r-- | client/mysqltest.c | 11 | ||||
-rw-r--r-- | mysql-test/mysql-test-run.sh | 9 | ||||
-rw-r--r-- | mysql-test/r/rpl_failsafe.result | 12 | ||||
-rw-r--r-- | mysql-test/t/rpl_failsafe.test | 4 | ||||
-rw-r--r-- | sql/mysqld.cc | 5 | ||||
-rw-r--r-- | sql/repl_failsafe.cc | 6 | ||||
-rw-r--r-- | sql/repl_failsafe.h | 2 | ||||
-rw-r--r-- | sql/sql_show.cc | 1 |
8 files changed, 37 insertions, 13 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c index 1374a276231..c6169540469 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -92,7 +92,7 @@ static char *db = 0, *pass=0; const char* user = 0, *host = 0, *unix_sock = 0, *opt_basedir="./"; static int port = 0, opt_big_test=0, opt_compress=0; static uint start_lineno, *lineno; -const char* manager_user="root",*manager_host="localhost"; +const char* manager_user="root",*manager_host=0; char *manager_pass=0; int manager_port=MYSQL_MANAGER_PORT; int manager_wait_timeout=3; @@ -655,6 +655,10 @@ int do_server_op(struct st_query* q,const char* op) { char* p=q->first_argument; char com_buf[256],*com_p; + if (!manager) + { + die("Manager is not initialized, manager commands are not possible"); + } com_p=strmov(com_buf,op); com_p=strmov(com_p,"_exec "); if (!*p) @@ -2195,8 +2199,9 @@ int main(int argc, char** argv) if (cur_file == file_stack) *++cur_file = stdin; *lineno=1; -#ifndef EMBEDDED_LIBRARY - init_manager(); +#ifndef EMBEDDED_LIBRARY + if (manager_host) + init_manager(); #endif if (!( mysql_init(&cur_con->mysql))) die("Failed in mysql_init()"); diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 733dfebd450..8f824d82a08 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -538,7 +538,8 @@ start_manager() $MYSQL_MANAGER --log=$MYSQL_MANAGER_LOG --port=$MYSQL_MANAGER_PORT \ --password-file=$MYSQL_MANAGER_PW_FILE abort_if_failed "Could not start MySQL manager" - mysqltest_manager_args="--manager-user=$MYSQL_MANAGER_USER \ + mysqltest_manager_args="--manager-host=localhost \ + --manager-user=$MYSQL_MANAGER_USER \ --manager-password=$MYSQL_MANAGER_PW \ --manager-port=$MYSQL_MANAGER_PORT \ --manager-wait-timeout=$START_WAIT_TIMEOUT" @@ -600,7 +601,7 @@ start_master() then master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \ --server-id=1 --rpl-recovery-rank=1 \ - --basedir=$MY_BASEDIR \ + --basedir=$MY_BASEDIR --init-rpl-role=master \ --port=$MASTER_MYPORT \ --exit-info=256 \ --datadir=$MASTER_MYDDIR \ @@ -617,7 +618,7 @@ start_master() else master_args="--no-defaults --log-bin=$MYSQL_TEST_DIR/var/log/master-bin \ --server-id=1 --rpl-recovery-rank=1 \ - --basedir=$MY_BASEDIR \ + --basedir=$MY_BASEDIR --init-rpl-role=master \ --port=$MASTER_MYPORT \ --datadir=$MASTER_MYDDIR \ --pid-file=$MASTER_MYPID \ @@ -712,7 +713,7 @@ start_slave() --socket=$slave_sock \ --character-sets-dir=$CHARSETSDIR \ --default-character-set=$CHARACTER_SET \ - --core \ + --core --init-rpl-role=slave \ --tmpdir=$MYSQL_TMP_DIR \ --language=$LANGUAGE \ --skip-innodb --skip-slave-start \ diff --git a/mysql-test/r/rpl_failsafe.result b/mysql-test/r/rpl_failsafe.result index 3f36bf8b83a..596d6ef7191 100644 --- a/mysql-test/r/rpl_failsafe.result +++ b/mysql-test/r/rpl_failsafe.result @@ -6,12 +6,24 @@ slave start; show variables like 'rpl_recovery_rank'; Variable_name Value rpl_recovery_rank 1 +show status like 'Rpl_status'; +Variable_name Value +Rpl_status AUTH_MASTER show variables like 'rpl_recovery_rank'; Variable_name Value rpl_recovery_rank 2 +show status like 'Rpl_status'; +Variable_name Value +Rpl_status IDLE_SLAVE show variables like 'rpl_recovery_rank'; Variable_name Value rpl_recovery_rank 3 +show status like 'Rpl_status'; +Variable_name Value +Rpl_status IDLE_SLAVE show variables like 'rpl_recovery_rank'; Variable_name Value rpl_recovery_rank 4 +show status like 'Rpl_status'; +Variable_name Value +Rpl_status IDLE_SLAVE diff --git a/mysql-test/t/rpl_failsafe.test b/mysql-test/t/rpl_failsafe.test index 75f1c9ee3b2..f93dbf4b118 100644 --- a/mysql-test/t/rpl_failsafe.test +++ b/mysql-test/t/rpl_failsafe.test @@ -3,9 +3,13 @@ connect (slave_sec,localhost,root,,test,0,slave.sock-1); connect (slave_ter,localhost,root,,test,0,slave.sock-2); connection master; show variables like 'rpl_recovery_rank'; +show status like 'Rpl_status'; connection slave; show variables like 'rpl_recovery_rank'; +show status like 'Rpl_status'; connection slave_sec; show variables like 'rpl_recovery_rank'; +show status like 'Rpl_status'; connection slave_ter; show variables like 'rpl_recovery_rank'; +show status like 'Rpl_status'; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 870c241af13..ca9c0bae682 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2598,7 +2598,7 @@ enum options { OPT_REPORT_USER, OPT_REPORT_PASSWORD, OPT_REPORT_PORT, OPT_SHOW_SLAVE_AUTH_INFO, OPT_OLD_RPL_COMPAT, OPT_SLAVE_LOAD_TMPDIR, OPT_NO_MIX_TYPE, - OPT_RPL_RECOVERY_RANK + OPT_RPL_RECOVERY_RANK,OPT_INIT_RPL_ROLE }; static struct option long_options[] = { @@ -2634,6 +2634,7 @@ static struct option long_options[] = { {"enable-pstack", no_argument, 0, (int) OPT_DO_PSTACK}, {"exit-info", optional_argument, 0, 'T'}, {"flush", no_argument, 0, (int) OPT_FLUSH}, + {"init-rpl-role", required_argument, 0, (int) OPT_INIT_RPL_ROLE}, /* We must always support this option to make scripts like mysqltest easier to do */ {"innodb_data_file_path", required_argument, 0, @@ -3502,7 +3503,7 @@ static void get_options(int argc,char **argv) fprintf(stderr, "Unknown replication role: %s\n", optarg); exit(1); } - rpl_status = (rpl_role == 1) ? RPL_AUTH_MASTER : RPL_IDLE_SLAVE; + rpl_status = (role == 1) ? RPL_AUTH_MASTER : RPL_IDLE_SLAVE; break; } case (int)OPT_REPLICATE_IGNORE_DB: diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 541c53ea24a..bdd63bd9a10 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -23,9 +23,9 @@ RPL_STATUS rpl_status=RPL_NULL; pthread_mutex_t LOCK_rpl_status; pthread_cond_t COND_rpl_status; -const char *rpl_role_type[] = {"","MASTER","SLAVE",NullS}; -TYPELIB rpl_role_typelib = {array_elements(rpl_role_type)-4,"", - rpl_role_type+1}; +const char *rpl_role_type[] = {"MASTER","SLAVE",NullS}; +TYPELIB rpl_role_typelib = {array_elements(rpl_role_type)-1,"", + rpl_role_type}; const char* rpl_status_type[] = {"AUTH_MASTER","ACTIVE_SLAVE","IDLE_SLAVE", "LOST_SOLDIER","TROOP_SOLDIER", diff --git a/sql/repl_failsafe.h b/sql/repl_failsafe.h index 1f62da7b05e..95069404acb 100644 --- a/sql/repl_failsafe.h +++ b/sql/repl_failsafe.h @@ -9,5 +9,5 @@ extern RPL_STATUS rpl_status; extern pthread_mutex_t LOCK_rpl_status; extern pthread_cond_t COND_rpl_status; extern TYPELIB rpl_role_typelib, rpl_status_typelib; -extern char* rpl_role_type[], *rpl_status_type; +extern const char* rpl_role_type[], *rpl_status_type[]; #endif diff --git a/sql/sql_show.cc b/sql/sql_show.cc index dba6b55443c..19c3d89caaf 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -20,6 +20,7 @@ #include "mysql_priv.h" #include "sql_select.h" // For select_describe #include "sql_acl.h" +#include "repl_failsafe.h" #include <my_dir.h> #ifdef HAVE_BERKELEY_DB |