24#ifndef RPL_IO_MONITOR_H
25#define RPL_IO_MONITOR_H
48 std::tuple<std::string, std::string,
uint, std::string,
uint, std::string,
204 const std::string &channel_name);
339 std::tuple<int, bool, bool, std::tuple<std::string, std::string, uint>>
343 std::vector<RPL_FAILOVER_SOURCE_TUPLE> &group_membership_detail,
344 uint &curr_highest_group_weight,
uint &curr_conn_weight);
361 std::vector<RPL_FAILOVER_SOURCE_TUPLE> &source_conn_list);
382 std::vector<std::string> field_name,
383 std::tuple<std::string, std::string, uint> conn_detail);
405 std::vector<std::string> field_name,
Mysql client connection wrapper class to connect MySQL, execute SQL query and fetch query results.
Definition: rpl_mysql_connect.h:56
The class are wrappers for handler index and random scan functions to simplify their usage.
Definition: rpl_sys_table_access.h:43
Class that contains functionality to monitor group member's state, role and quorum changes on all the...
Definition: rpl_io_monitor.h:126
void source_monitor_handler()
The function started by Monitor IO thread which does monitor group member's state,...
Definition: rpl_io_monitor.cc:223
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 plu...
Definition: rpl_io_monitor.cc:792
void set_monitoring_wait(uint wait_time)
Sets the delay between each iteration where it fetches group details.
Definition: rpl_io_monitor.cc:1077
bool has_primary_lost_contact_with_majority()
Checks if primary member has lost contact with majority.
Definition: rpl_io_monitor.cc:768
thread_state m_monitor_thd_state
Definition: rpl_io_monitor.h:250
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.
Definition: rpl_io_monitor.cc:317
my_thread_handle m_th
Definition: rpl_io_monitor.h:247
Source_IO_monitor & operator=(const Source_IO_monitor &)=delete
std::string get_query(enum_sql_query_tag qtag)
Gets the sql query string.
Definition: rpl_io_monitor.cc:164
std::tuple< bool, std::vector< SENDER_CONN_MERGE_TUPLE > > get_senders_details(const std::string &channel_name)
It gets stored senders details for channel from replication_asynchronous_connection_failover table.
Definition: rpl_io_monitor.cc:971
virtual ~Source_IO_monitor()
Definition: rpl_io_monitor.cc:180
THD * m_monitor_thd
Definition: rpl_io_monitor.h:232
Source_IO_monitor()
Definition: rpl_io_monitor.cc:170
uint m_retry_monitor_wait
Definition: rpl_io_monitor.h:238
int terminate_monitoring_process()
Terminate the Monitor IO thread.
Definition: rpl_io_monitor.cc:1029
bool m_abort_monitor
Definition: rpl_io_monitor.h:235
bool launch_monitoring_process(PSI_thread_key thread_key)
Creates and launches new Monitor IO thread.
Definition: rpl_io_monitor.cc:193
int connect_senders(THD *thd, const std::string &channel_name)
It gets stored senders details for channel from replication_asynchronous_connection_failover table,...
Definition: rpl_io_monitor.cc:337
Source_IO_monitor(const Source_IO_monitor &)=delete
bool m_primary_lost_contact_with_majority_warning_logged
Definition: rpl_io_monitor.h:252
int sync_senders_details(THD *thd)
It gets stored senders details for channel from replication_asynchronous_connection_failover table,...
Definition: rpl_io_monitor.cc:933
bool is_monitoring_process_running()
Gets the status of monitor IO thread whether its running.
Definition: rpl_io_monitor.cc:1083
mysql_cond_t m_run_cond
Definition: rpl_io_monitor.h:244
enum_res_col
Definition: rpl_io_monitor.h:255
@ COL_STATE
Definition: rpl_io_monitor.h:259
@ COL_ROLE
Definition: rpl_io_monitor.h:260
@ COL_GROUP_NAME
Definition: rpl_io_monitor.h:256
@ COL_HOST
Definition: rpl_io_monitor.h:257
@ COL_PORT
Definition: rpl_io_monitor.h:258
bool is_monitor_killed(THD *thd, Master_info *mi)
Check if Monitor IO thread is killed.
Definition: rpl_io_monitor.cc:186
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.
Definition: rpl_io_monitor.cc:602
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.
Definition: rpl_io_monitor.cc:297
static Source_IO_monitor * get_instance()
Fetch Source_IO_monitor class instance.
Definition: rpl_io_monitor.cc:1087
uint get_monitoring_wait()
Gets the delay time between each iteration where it fetches group details.
Definition: rpl_io_monitor.cc:1081
mysql_mutex_t m_run_lock
Definition: rpl_io_monitor.h:241
const char * primary_weight_str()
Gets the Json key for primary weight for the Configuration column of replication_asynchronous_connect...
Definition: rpl_io_monitor.h:424
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.
Definition: rpl_io_monitor.cc:583
const char * secondary_weight_str()
Gets the Json key for secondary weight for the Configuration column of replication_asynchronous_conne...
Definition: rpl_io_monitor.h:433
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
unsigned int PSI_thread_key
Instrumented thread key.
Definition: psi_thread_bits.h:50
static int wait_time
Definition: mysql.cc:201
required string managed_name
Definition: replication_asynchronous_connection_failover.proto:36
std::tuple< std::string, std::string, uint, std::string, uint, std::string > RPL_FAILOVER_SOURCE_TUPLE
Definition: rpl_async_conn_failover_table_operations.h:42
enum_sql_query_tag
Definition: rpl_io_monitor.h:52
@ CONFIG_MODE_QUORUM_MONITOR
@ QUERY_SERVER_SELECT_ONE
@ GR_MEMBER_ALL_DETAILS_FETCH_FOR_57
std::unique_ptr< Mysql_connection > MYSQL_CONN_PTR
Definition: rpl_io_monitor.h:38
std::tuple< std::string, std::string, uint > MYSQL_CONN_KEY
Definition: rpl_io_monitor.h:41
std::tuple< std::string, std::string, uint, std::string, uint, std::string, uint, uint > SENDER_CONN_MERGE_TUPLE
Connection managed tuple <channel, host, port, network_namespace, weight, managed_name,...
Definition: rpl_io_monitor.h:49
enum_conf_mode_quorum_status
Definition: rpl_io_monitor.h:61
Definition: my_thread_bits.h:52
An instrumented cond structure.
Definition: mysql_cond_bits.h:50
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
Definition: plugin_utils.h:47
bool is_thread_alive() const
Definition: rpl_io_monitor.h:112
thread_state()
Definition: rpl_io_monitor.h:87
bool is_initialized() const
Definition: rpl_io_monitor.h:99
void set_initialized()
Definition: rpl_io_monitor.h:95
bool is_thread_dead() const
Definition: rpl_io_monitor.h:117
thread_state_enum
Maintains thread status.
Definition: plugin_utils.h:52
@ THREAD_NONE
THREAD_NOT_CREATED.
Definition: plugin_utils.h:53
@ THREAD_RUNNING
THREAD_RUNNING.
Definition: plugin_utils.h:57
@ THREAD_TERMINATED
THREAD_EXIT.
Definition: plugin_utils.h:59
@ THREAD_INIT
THREAD_INIT.
Definition: plugin_utils.h:55
@ THREAD_END
END OF ENUM.
Definition: plugin_utils.h:60
@ THREAD_CREATED
THREAD_CREATED.
Definition: plugin_utils.h:54
void set_running()
Definition: rpl_io_monitor.h:89
bool is_running() const
Definition: rpl_io_monitor.h:104
void set_created()
Definition: rpl_io_monitor.h:97
thread_state_enum thread_state_var
Definition: plugin_utils.h:64
bool is_alive_not_running() const
Definition: rpl_io_monitor.h:108
void set_terminated()
Definition: rpl_io_monitor.h:91
unsigned int uint
Definition: uca9-dump.cc:75