diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 249bf76..901b14b 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -1384,4 +1384,21 @@ bool Master_info_index::stop_all_slaves(THD *thd) DBUG_RETURN(result); } +bool Master_info_index::flush_all_relay_logs() +{ + for (uint i=0; i < master_info_hash.records; i++) + { + Master_info *mi; + mi= (Master_info *)my_hash_element(&master_info_hash, i); + mysql_mutex_lock(&mi->data_lock); + if (rotate_relay_log(mi)) + { + mysql_mutex_unlock(&mi->data_lock); + return true; + } + mysql_mutex_unlock(&mi->data_lock); + } + return false; +} + #endif /* HAVE_REPLICATION */ diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h index e58df01..e7ae7d2 100644 --- a/sql/rpl_mi.h +++ b/sql/rpl_mi.h @@ -225,6 +225,7 @@ class Master_info_index uint any_slave_sql_running(); bool start_all_slaves(THD *thd); bool stop_all_slaves(THD *thd); + bool flush_all_relay_logs(); }; diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc index bcf2585..752f3c9 100644 --- a/sql/sql_reload.cc +++ b/sql/sql_reload.cc @@ -177,7 +177,12 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options, mysql_mutex_lock(&LOCK_active_mi); if (master_info_index) { - if (!(mi= (master_info_index-> + if (connection_name.length == 0) + { + if(master_info_index->flush_all_relay_logs()) + *write_to_binlog= -1; + } + else if (!(mi= (master_info_index-> get_master_info(&connection_name, Sql_condition::WARN_LEVEL_ERROR)))) {