summaryrefslogtreecommitdiff
path: root/sql/rpl_mi.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2016-01-03 13:20:07 +0200
committerMonty <monty@mariadb.org>2016-01-03 13:20:07 +0200
commit661a6d89065390ca1e9b4be05219b75f850ed290 (patch)
tree5e58bf86d9880d4cfc23eb71e074135b9e3ed45a /sql/rpl_mi.cc
parent4b4777ab63522b2bdd1f98ad03558a5b1da53dc0 (diff)
downloadmariadb-git-661a6d89065390ca1e9b4be05219b75f850ed290.tar.gz
Cleanup of slave code:
- Added testing if connection is killed to shortcut reading of connection data This will allow us later in 10.2 to do a cleaner shutdown of slaves (less errors in the log) - Add new status variables: Slaves_connected, Slaves_running and Slave_connections. - Use MYSQL_SLAVE_NOT_RUN instead of 0 with slave_running. - Don't print obvious extra warnings to the error log when slave is shut down normally.
Diffstat (limited to 'sql/rpl_mi.cc')
-rw-r--r--sql/rpl_mi.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index ae6cc1ac0a2..a7ee3f3f45e 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -35,7 +35,8 @@ Master_info::Master_info(LEX_STRING *connection_name_arg,
rli(is_slave_recovery), port(MYSQL_PORT),
checksum_alg_before_fd(BINLOG_CHECKSUM_ALG_UNDEF),
connect_retry(DEFAULT_CONNECT_RETRY), inited(0), abort_slave(0),
- slave_running(0), slave_run_id(0), clock_diff_with_master(0),
+ slave_running(MYSQL_SLAVE_NOT_RUN), slave_run_id(0),
+ clock_diff_with_master(0),
sync_counter(0), heartbeat_period(0), received_heartbeats(0),
master_id(0), prev_master_id(0),
using_gtid(USE_GTID_NO), events_queued_since_last_gtid(0),
@@ -1273,23 +1274,24 @@ bool Master_info_index::give_error_if_slave_running()
The LOCK_active_mi must be held while calling this function.
@return
- TRUE If some slave SQL thread is running.
- FALSE No slave SQL thread is running
+ 0 No Slave SQL thread is running
+ # Number of slave SQL thread running
*/
-bool Master_info_index::any_slave_sql_running()
+uint Master_info_index::any_slave_sql_running()
{
+ uint count= 0;
DBUG_ENTER("any_slave_sql_running");
if (!this) // master_info_index is set to NULL on server shutdown
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(count);
for (uint i= 0; i< master_info_hash.records; ++i)
{
Master_info *mi= (Master_info *)my_hash_element(&master_info_hash, i);
if (mi->rli.slave_running != MYSQL_SLAVE_NOT_RUN)
- DBUG_RETURN(TRUE);
+ count++;
}
- DBUG_RETURN(FALSE);
+ DBUG_RETURN(count);
}