diff options
Diffstat (limited to 'sql/rpl_mi.cc')
-rw-r--r-- | sql/rpl_mi.cc | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index d2b792a259d..02104af8cd3 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -1086,14 +1086,15 @@ bool Master_info_index::init_all_master_info() { /* Master_info is not in HASH; Add it */ if (master_info_index->add_master_info(mi, FALSE)) - return 1; + DBUG_RETURN(1); succ_num++; unlock_slave_threads(mi); } else { /* Master_info already in HASH */ - sql_print_error(ER(ER_CONNECTION_ALREADY_EXISTS), + sql_print_error(ER_THD_OR_DEFAULT(current_thd, + ER_CONNECTION_ALREADY_EXISTS), (int) connection_name.length, connection_name.str); unlock_slave_threads(mi); delete mi; @@ -1110,7 +1111,8 @@ bool Master_info_index::init_all_master_info() Sql_condition::WARN_LEVEL_NOTE)) { /* Master_info was already registered */ - sql_print_error(ER(ER_CONNECTION_ALREADY_EXISTS), + sql_print_error(ER_THD_OR_DEFAULT(current_thd, + ER_CONNECTION_ALREADY_EXISTS), (int) connection_name.length, connection_name.str); unlock_slave_threads(mi); delete mi; @@ -1119,18 +1121,19 @@ bool Master_info_index::init_all_master_info() /* Master_info was not registered; add it */ if (master_info_index->add_master_info(mi, FALSE)) - return 1; + DBUG_RETURN(1); succ_num++; unlock_slave_threads(mi); if (!opt_skip_slave_start) { - if (start_slave_threads(1 /* need mutex */, - 0 /* no wait for start*/, - mi, - buf_master_info_file, - buf_relay_log_info_file, - SLAVE_IO | SLAVE_SQL)) + if (start_slave_threads(current_thd, + 1 /* need mutex */, + 0 /* no wait for start*/, + mi, + buf_master_info_file, + buf_relay_log_info_file, + SLAVE_IO | SLAVE_SQL)) { sql_print_error("Failed to create slave threads for connection '%.*s'", (int) connection_name.length, @@ -1216,7 +1219,7 @@ Master_info_index::get_master_info(const LEX_STRING *connection_name, mysql_mutex_assert_owner(&LOCK_active_mi); if (!this) // master_info_index is set to NULL on server shutdown - return NULL; + DBUG_RETURN(NULL); /* Make name lower case for comparison */ res= strmake(buff, connection_name->str, connection_name->length); @@ -1371,7 +1374,7 @@ bool Master_info_index::give_error_if_slave_running() DBUG_ENTER("give_error_if_slave_running"); mysql_mutex_assert_owner(&LOCK_active_mi); if (!this) // master_info_index is set to NULL on server shutdown - return TRUE; + DBUG_RETURN(TRUE); for (uint i= 0; i< master_info_hash.records; ++i) { @@ -1402,7 +1405,7 @@ bool Master_info_index::any_slave_sql_running() { DBUG_ENTER("any_slave_sql_running"); if (!this) // master_info_index is set to NULL on server shutdown - return TRUE; + DBUG_RETURN(TRUE); for (uint i= 0; i< master_info_hash.records; ++i) { @@ -1453,9 +1456,9 @@ bool Master_info_index::start_all_slaves(THD *thd) if (error < 0) // fatal error break; } - else + else if (thd) push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, - ER_SLAVE_STARTED, ER(ER_SLAVE_STARTED), + ER_SLAVE_STARTED, ER_THD(thd, ER_SLAVE_STARTED), (int) mi->connection_name.length, mi->connection_name.str); } @@ -1469,6 +1472,8 @@ bool Master_info_index::start_all_slaves(THD *thd) Start all slaves that was not running. + @param thread id from user + @return TRUE Error FALSE Everything ok. @@ -1479,6 +1484,7 @@ bool Master_info_index::stop_all_slaves(THD *thd) bool result= FALSE; DBUG_ENTER("warn_if_slave_running"); mysql_mutex_assert_owner(&LOCK_active_mi); + DBUG_ASSERT(thd); for (uint i= 0; i< master_info_hash.records; ++i) { @@ -1500,7 +1506,7 @@ bool Master_info_index::stop_all_slaves(THD *thd) } else push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, - ER_SLAVE_STOPPED, ER(ER_SLAVE_STOPPED), + ER_SLAVE_STOPPED, ER_THD(thd, ER_SLAVE_STOPPED), (int) mi->connection_name.length, mi->connection_name.str); } |