diff options
26 files changed, 90 insertions, 10 deletions
diff --git a/include/mysqld_error.h b/include/mysqld_error.h index ca3fe07e889..2f4158110cd 100644 --- a/include/mysqld_error.h +++ b/include/mysqld_error.h @@ -268,4 +268,6 @@ #define ER_NOT_SUPPORTED_AUTH_MODE 1249 #define ER_SPATIAL_CANT_HAVE_NULL 1250 #define ER_COLLATION_CHARSET_MISMATCH 1251 -#define ER_ERROR_MESSAGES 252 +#define ER_SLAVE_WAS_RUNNING 1252 +#define ER_SLAVE_WAS_NOT_RUNNING 1253 +#define ER_ERROR_MESSAGES 254 diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc index 008466c426f..5ec4b4379f8 100644 --- a/mysql-test/include/master-slave.inc +++ b/mysql-test/include/master-slave.inc @@ -3,8 +3,11 @@ connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,); connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,); connection slave; ---error 0,1199 -!stop slave; +#we expect STOP SLAVE to produce a warning as the slave is stopped +#(the server was started with skip-slave-start) +--disable_warnings +stop slave; +--enable_warnings @r/slave-stopped.result show status like 'Slave_running'; connection master; --disable_warnings diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index dd64cd1dbf0..169595c34c5 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -262,3 +262,5 @@ v/* "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index c17f983d995..ff58079f4c8 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -256,3 +256,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 574d029ef0b..a0a6755c693 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -264,3 +264,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index b89556bd92c..0f48416d6db 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -253,3 +253,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 2b56e648fa2..4503f011692 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -258,3 +258,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 199f85b6e8e..9474d67f2f2 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -253,3 +253,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index feeb8b73d3e..ef4110a6b93 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -263,3 +263,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client", "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index 31bc7aeec27..3f54e7740bd 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -253,3 +253,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 0dd1a8584f4..7519448ef33 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -255,3 +255,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 7d502c29685..71a02896c01 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -253,3 +253,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 2685994c9f2..b10ddb1d1d2 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -255,3 +255,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index d2ccc9197eb..be1e85ad33c 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -253,3 +253,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index c8f15851abf..84c96a0540e 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -255,3 +255,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index 3d3091d2182..b57eb19906d 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -255,3 +255,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index f8c813c30c3..7ffec4b6519 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -257,3 +257,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 1477c60c151..8db48115c49 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -253,3 +253,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index b1f116ff875..337cfd0963e 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -257,3 +257,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 848d9969d58..666f8e01232 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -256,3 +256,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index 748bada66b4..d6883efc96b 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -249,3 +249,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 6bf1440e2a6..ee7d1e9c4fb 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -261,3 +261,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index 6033e19cb7c..2dfdc7573fa 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -254,3 +254,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index 02a0c445c26..517232fe2a9 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -253,3 +253,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index 68a94e43d97..be8fe2afea5 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -258,3 +258,5 @@ "Client does not support authentication protocol requested by server. Consider upgrading MySQL client" "All parts of a SPATIAL KEY must be NOT NULL" "COLLATION '%s' is not valid for CHARACTER SET '%s'" +"The slave was already running" +"The slave was already stopped" diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 05a70c24bfd..90beb89bb37 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -622,7 +622,7 @@ Increase max_allowed_packet on master"; int start_slave(THD* thd , MASTER_INFO* mi, bool net_report) { - int slave_errno = 0; + int slave_errno; if (!thd) thd = current_thd; int thread_mask; @@ -631,10 +631,17 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report) if (check_access(thd, SUPER_ACL, any_db)) DBUG_RETURN(1); lock_slave_threads(mi); // this allows us to cleanly read slave_running + // Get a mask of _stopped_ threads init_thread_mask(&thread_mask,mi,1 /* inverse */); + /* + Below we will start all stopped threads. + But if the user wants to start only one thread, do as if the other thread + was running (as we don't wan't to touch the other thread), so set the + bit to 0 for the other thread + */ if (thd->lex.slave_thd_opt) thread_mask &= thd->lex.slave_thd_opt; - if (thread_mask) + if (thread_mask) //some threads are stopped, start them { if (init_master_info(mi,master_info_file,relay_log_info_file, 0)) slave_errno=ER_MASTER_INFO; @@ -648,7 +655,12 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report) slave_errno = ER_BAD_SLAVE; } else - slave_errno = ER_SLAVE_MUST_STOP; + { + //no error if all threads are already started, only a warning + slave_errno= 0; + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_SLAVE_WAS_RUNNING, + ER(ER_SLAVE_WAS_RUNNING)); + } unlock_slave_threads(mi); @@ -667,7 +679,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report) int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report ) { - int slave_errno = 0; + int slave_errno; if (!thd) thd = current_thd; @@ -676,12 +688,29 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report ) thd->proc_info = "Killing slave"; int thread_mask; lock_slave_threads(mi); + // Get a mask of _running_ threads init_thread_mask(&thread_mask,mi,0 /* not inverse*/); + /* + Below we will stop all running threads. + But if the user wants to stop only one thread, do as if the other thread + was stopped (as we don't wan't to touch the other thread), so set the + bit to 0 for the other thread + */ if (thd->lex.slave_thd_opt) thread_mask &= thd->lex.slave_thd_opt; - slave_errno = (thread_mask) ? - terminate_slave_threads(mi,thread_mask, - 1 /*skip lock */) : ER_SLAVE_NOT_RUNNING; + + if (thread_mask) + { + slave_errno= terminate_slave_threads(mi,thread_mask, + 1 /*skip lock */); + } + else + { + //no error if both threads are already stopped, only a warning + slave_errno= 0; + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_SLAVE_WAS_NOT_RUNNING, + ER(ER_SLAVE_WAS_NOT_RUNNING)); + } unlock_slave_threads(mi); thd->proc_info = 0; |