Class that contains functionality to monitor group member's state, role and quorum changes on all the potential senders in the Sender List, and if it finds any changes or lost quorum it does automatic update of the sender list.
More...
#include <rpl_io_monitor.h>
|
int | sync_senders_details (THD *thd) |
| It gets stored senders details for channel from replication_asynchronous_connection_failover table, and then connects to it. More...
|
|
int | connect_senders (THD *thd, const std::string &channel_name) |
| It gets stored senders details for channel from replication_asynchronous_connection_failover table, and then connects to it. More...
|
|
bool | check_connection_and_run_query (THD *thd, Master_info *mi, RPL_FAILOVER_SOURCE_TUPLE &conn_detail) |
| It connects to server and runs a simple query. More...
|
|
std::tuple< int, bool, bool, std::tuple< std::string, std::string, uint > > | get_online_members (THD *thd, Master_info *mi, const Mysql_connection *conn, SENDER_CONN_MERGE_TUPLE source_conn_detail, std::vector< RPL_FAILOVER_SOURCE_TUPLE > &group_membership_detail, uint &curr_highest_group_weight, uint &curr_conn_weight) |
| It connects to each stored sender in connect_senders() and check for quorum and group replication plugin enabled. More...
|
|
int | save_group_members (std::string channel_name, std::string managed_name, std::vector< RPL_FAILOVER_SOURCE_TUPLE > &source_conn_list) |
| Store gathered membership details to replication_asynchronous_connection_failover table. More...
|
|
std::tuple< bool, std::string > | delete_rows (Rpl_sys_table_access &table_op, TABLE *table, std::vector< std::string > field_name, std::tuple< std::string, std::string, uint > conn_detail) |
| Delete provided row to the table with commit. More...
|
|
std::tuple< bool, std::string > | write_rows (Rpl_sys_table_access &table_op, TABLE *table, std::vector< std::string > field_name, RPL_FAILOVER_SOURCE_TUPLE conn_detail) |
| Insert provided row to the table with commit. More...
|
|
bool | has_primary_lost_contact_with_majority () |
| Checks if primary member has lost contact with majority. More...
|
|
const char * | primary_weight_str () |
| Gets the Json key for primary weight for the Configuration column of replication_asynchronous_connection_failover_managed table. More...
|
|
const char * | secondary_weight_str () |
| Gets the Json key for secondary weight for the Configuration column of replication_asynchronous_connection_failover_managed table. More...
|
|
Class that contains functionality to monitor group member's state, role and quorum changes on all the potential senders in the Sender List, and if it finds any changes or lost quorum it does automatic update of the sender list.
◆ enum_res_col
Enumerator |
---|
COL_GROUP_NAME | |
COL_HOST | |
COL_PORT | |
COL_STATE | |
COL_ROLE | |
◆ Source_IO_monitor() [1/2]
Source_IO_monitor::Source_IO_monitor |
( |
| ) |
|
◆ ~Source_IO_monitor()
Source_IO_monitor::~Source_IO_monitor |
( |
| ) |
|
|
virtual |
◆ Source_IO_monitor() [2/2]
◆ check_connection_and_run_query()
It connects to server and runs a simple query.
- Parameters
-
[in] | thd | The thread. |
[in] | mi | The pointer to the Master_info object. |
[in] | conn_detail | std::tuple containing <channel, host, port, network_namespace, weight, group_name> |
- Returns
- true on success false on failure like unable to connect or query fails
◆ connect_senders()
int Source_IO_monitor::connect_senders |
( |
THD * |
thd, |
|
|
const std::string & |
channel_name |
|
) |
| |
|
private |
It gets stored senders details for channel from replication_asynchronous_connection_failover table, and then connects to it.
It also stores client connection object to all the connected stores.
- Parameters
-
[in] | thd | The thread. |
[in] | channel_name | The channel name. |
- Returns
- false if success, true otherwise.
◆ delete_rows()
std::tuple< bool, std::string > Source_IO_monitor::delete_rows |
( |
Rpl_sys_table_access & |
table_op, |
|
|
TABLE * |
table, |
|
|
std::vector< std::string > |
field_name, |
|
|
std::tuple< std::string, std::string, uint > |
conn_detail |
|
) |
| |
|
private |
Delete provided row to the table with commit.
- Parameters
-
[in] | table_op | The Rpl_sys_table_access class object. |
[in] | table | The table object. |
[in] | field_name | The name of column/field of the table. |
[in] | conn_detail | std::tuple containing <channel, host, port> |
- Returns
- std::tuple<bool, std::string> where each element has following meaning:
first element of tuple is function return value and determines: false Successful true Error
second element of tuple is error message.
◆ get_instance()
Fetch Source_IO_monitor class instance.
- Returns
- Pointer to the Source_IO_monitor class instance.
◆ get_monitoring_wait()
uint Source_IO_monitor::get_monitoring_wait |
( |
| ) |
|
Gets the delay time between each iteration where it fetches group details.
- Returns
- the delay time in seconds.
◆ get_online_members()
std::tuple< int, bool, bool, std::tuple< std::string, std::string, uint > > Source_IO_monitor::get_online_members |
( |
THD * |
thd, |
|
|
Master_info * |
mi, |
|
|
const Mysql_connection * |
conn, |
|
|
SENDER_CONN_MERGE_TUPLE |
source_conn_detail, |
|
|
std::vector< RPL_FAILOVER_SOURCE_TUPLE > & |
group_membership_detail, |
|
|
uint & |
curr_highest_group_weight, |
|
|
uint & |
curr_conn_weight |
|
) |
| |
|
private |
It connects to each stored sender in connect_senders() and check for quorum and group replication plugin enabled.
It gets group membership list if group replication plugin is enabled and its also has quorum.
- Parameters
-
[in] | thd | The thread. |
[in] | mi | The pointer to the Master_info object. |
[in] | conn | The Mysql_connection class object to query remote source. |
[in] | source_conn_detail | std::tuple containing <channel, host, port, network_namespace, weight, group_name, primary_weight, secondary_weight>. |
[out] | group_membership_detail | std::tuple containing <channel, host, port, network_namespace, weight, group_name> |
[out] | curr_highest_group_weight | the highest weight of the source for the group |
[out] | curr_conn_weight | weight for current connected sender |
- Returns
- std::tuple<int, uint, bool, bool, std::tuple<std::string, std::string, uint>> where each element has following meaning:
first element of tuple is function return value and determines: false Successful true Error
second element of tuple determine if the current connected member through asynchronous channel has changed the group.
third element of tuple determine if the current connected member through asynchronous channel has lost quorum.
fourth element of tuple is also a tuple containing <channel, host, port> of member who lost quorum. It is only useful when fourth element of returned tuple is true.
◆ get_query()
Gets the sql query string.
- Parameters
-
[in] | qtag | the query to fetch. |
- Returns
- the sql query string.
◆ get_senders_details()
std::tuple< bool, std::vector< SENDER_CONN_MERGE_TUPLE > > Source_IO_monitor::get_senders_details |
( |
const std::string & |
channel_name | ) |
|
It gets stored senders details for channel from replication_asynchronous_connection_failover table.
- Parameters
-
[in] | channel_name | the channel from which get the senders |
- Returns
- std::tuple<bool, List_of_Tuple> where each element has following meaning:
first element of tuple is function return value and determines: false Successful true Error
second element of the tuple contains following details in tuple <channel, host, port, network_namespace, weight, managed_name, primary_weight, secondary_weight>
◆ has_primary_lost_contact_with_majority()
bool Source_IO_monitor::has_primary_lost_contact_with_majority |
( |
| ) |
|
|
private |
Checks if primary member has lost contact with majority.
- Returns
- status
- Return values
-
true | primary member has lost contact with majority |
false | otherwise |
◆ is_monitor_killed()
bool Source_IO_monitor::is_monitor_killed |
( |
THD * |
thd, |
|
|
Master_info * |
mi |
|
) |
| |
Check if Monitor IO thread is killed.
- Parameters
-
[in] | thd | The thread. |
[in] | mi | the pointer to the Master_info object. |
- Returns
- true if yes, false otherwise
◆ is_monitoring_process_running()
bool Source_IO_monitor::is_monitoring_process_running |
( |
| ) |
|
Gets the status of monitor IO thread whether its running.
- Returns
- true if monitor IO thread running, false otherwise.
◆ launch_monitoring_process()
bool Source_IO_monitor::launch_monitoring_process |
( |
PSI_thread_key |
thread_key | ) |
|
Creates and launches new Monitor IO thread.
- Parameters
-
[in] | thread_key | instrumentation key |
- Returns
- false in case of success, or true otherwise.
◆ operator=()
◆ primary_weight_str()
const char * Source_IO_monitor::primary_weight_str |
( |
| ) |
|
|
inlineprivate |
Gets the Json key for primary weight for the Configuration column of replication_asynchronous_connection_failover_managed table.
- Returns
- the Json key for primary weight for the Configuration column of replication_asynchronous_connection_failover_managed table.
◆ save_group_members()
int Source_IO_monitor::save_group_members |
( |
std::string |
channel_name, |
|
|
std::string |
managed_name, |
|
|
std::vector< RPL_FAILOVER_SOURCE_TUPLE > & |
source_conn_list |
|
) |
| |
|
private |
Store gathered membership details to replication_asynchronous_connection_failover table.
- Parameters
-
[in] | channel_name | The managed channel for which failover is enabled. |
[in] | managed_name | The group name UID value of the group. |
[in] | source_conn_list | The list of std::tuple containing <channel, host, port, network_namespace, weight, managed_name>. |
- Returns
- false if success, true otherwise.
◆ secondary_weight_str()
const char * Source_IO_monitor::secondary_weight_str |
( |
| ) |
|
|
inlineprivate |
Gets the Json key for secondary weight for the Configuration column of replication_asynchronous_connection_failover_managed table.
- Returns
- the Json key for secondary weight for the Configuration column of replication_asynchronous_connection_failover_managed table.
◆ set_monitoring_wait()
void Source_IO_monitor::set_monitoring_wait |
( |
uint |
wait_time | ) |
|
Sets the delay between each iteration where it fetches group details.
- Parameters
-
[in] | wait_time | the delay time in seconds to set. |
◆ source_monitor_handler()
void Source_IO_monitor::source_monitor_handler |
( |
| ) |
|
The function started by Monitor IO thread which does monitor group member's state, role and quorum changes on all the potential senders in the Sender List, and if it finds any changes or lost quorum it does automatic update of the sender list.
The thread runs in infinite loop till its not killed.
◆ sync_senders_details()
int Source_IO_monitor::sync_senders_details |
( |
THD * |
thd | ) |
|
|
private |
It gets stored senders details for channel from replication_asynchronous_connection_failover table, and then connects to it.
It also stores client connection object to all the connected stores. Then it gets group membership list from each sender.
- Parameters
-
- Returns
- 0 if success, error otherwise.
◆ terminate_monitoring_process()
int Source_IO_monitor::terminate_monitoring_process |
( |
| ) |
|
Terminate the Monitor IO thread.
- Returns
- 0 in case of success, or 1 otherwise.
◆ write_rows()
Insert provided row to the table with commit.
- Parameters
-
[in] | table_op | The Rpl_sys_table_access class object. |
[in] | table | The table object. |
[in] | field_name | The name of column/field of the table. |
[in] | conn_detail | std::tuple containing <channel, host, port, network_namespace, weight, group_name> |
- Returns
- std::tuple<bool, std::string> where each element has following meaning:
first element of tuple is function return value and determines: false Successful true Error
second element of tuple is error message.
◆ m_abort_monitor
bool Source_IO_monitor::m_abort_monitor {false} |
|
private |
◆ m_monitor_thd
◆ m_monitor_thd_state
◆ m_primary_lost_contact_with_majority_warning_logged
bool Source_IO_monitor::m_primary_lost_contact_with_majority_warning_logged {false} |
|
private |
◆ m_retry_monitor_wait
uint Source_IO_monitor::m_retry_monitor_wait {5} |
|
private |
◆ m_run_cond
◆ m_run_lock
◆ m_th
The documentation for this class was generated from the following files: