diff options
author | Sachin Setiya <sachin.setiya@mariadb.com> | 2017-05-26 15:23:15 +0530 |
---|---|---|
committer | Sachin Setiya <sachin.setiya@mariadb.com> | 2017-05-26 15:23:15 +0530 |
commit | 945fb51812a9c9969d7a15e5fbf90ced9b14a23b (patch) | |
tree | 961765bee0e35c4e2859f7b17ca54e750468e94b /sql | |
parent | 6bc9949210806a5c9630d5af17c74c8f2c54a227 (diff) | |
download | mariadb-git-9544.tar.gz |
MDEV-9544 FLUSH [RELAY] LOGS does not rotate logs for a named slave9544
Problem:- In the case of multisource replication/named slave
when we run "FLUSH LOGS" , it does not flush logs.
Solution:- A new function Master_info_index->flush_all_relay_logs()
is created which will rotate relay logs for all named slave.
This will be called in reload_acl_and_cache function when
connection_name.length == 0
Diffstat (limited to 'sql')
-rw-r--r-- | sql/rpl_mi.cc | 17 | ||||
-rw-r--r-- | sql/rpl_mi.h | 1 | ||||
-rw-r--r-- | sql/sql_reload.cc | 8 |
3 files changed, 24 insertions, 2 deletions
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index c9dcf7b8fd7..3b32afb75bd 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -1980,4 +1980,21 @@ void prot_store_ids(THD *thd, DYNAMIC_ARRAY *ids) return; } +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 31c0f280ac1..03ca5d00e41 100644 --- a/sql/rpl_mi.h +++ b/sql/rpl_mi.h @@ -354,6 +354,7 @@ public: bool start_all_slaves(THD *thd); bool stop_all_slaves(THD *thd); void free_connections(); + bool flush_all_relay_logs(); }; diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc index 995c4c0a838..376dfeb1542 100644 --- a/sql/sql_reload.cc +++ b/sql/sql_reload.cc @@ -181,8 +181,12 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options, slave is not likely to have the same connection names. */ tmp_write_to_binlog= 0; - - if (!(mi= (get_master_info(&connection_name, + if (connection_name.length == 0) + { + if (master_info_index->flush_all_relay_logs()) + *write_to_binlog= -1; + } + else if (!(mi= (get_master_info(&connection_name, Sql_condition::WARN_LEVEL_ERROR)))) { result= 1; |