MySQL 8.3.0
Source Code Documentation
Rpl_async_conn_failover_table_operations Class Reference

#include <rpl_async_conn_failover_table_operations.h>

Public Member Functions

 Rpl_async_conn_failover_table_operations (enum thr_lock_type lock_type=TL_WRITE)
 Construction. More...
 
virtual ~Rpl_async_conn_failover_table_operations ()=default
 
std::tuple< bool, std::string > add_source (const std::string &channel, const std::string &host, uint port, const std::string &network_namespace, uint weight, const std::string &managed_name)
 Insert row for a unmanaged sender on replication_asynchronous_connection_failover table, and send stored table data to its group replication group members. More...
 
std::tuple< bool, std::string > add_managed (const std::string &channel, const std::string &host, uint port, const std::string &network_namespace, const std::string &managed_type, const std::string &managed_name, uint primary_weight, uint secondary_weight)
 Insert row on replication_asynchronous_connection_failover_managed and replication_asynchronous_connection_failover tables, and send stored table data to its group replication group members. More...
 
std::tuple< bool, std::string > delete_source (const std::string &channel, const std::string &host, uint port, const std::string &network_namespace)
 Delete row for a unmanaged sender on replication_asynchronous_connection_failover table. More...
 
std::tuple< bool, std::string > delete_managed (const std::string &channel, const std::string &managed_name)
 Delete row on replication_asynchronous_connection_failover_managed table and all its sources on replication_asynchronous_connection_failover table. More...
 
bool reset ()
 Delete all rows on replication_asynchronous_connection_failover_managed and replication_asynchronous_connection_failover tables, and delete its respective rows on replication_group_configuration_version table. More...
 
std::tuple< bool, std::vector< RPL_FAILOVER_SOURCE_TUPLE > > read_source_rows_for_channel (std::string channel_name)
 Read all sources for a channel. More...
 
std::tuple< bool, std::vector< RPL_FAILOVER_SOURCE_TUPLE > > read_source_rows_for_channel_and_managed_name (std::string channel_name, std::string managed_name)
 Real all sources for a channel and a managed name. More...
 
bool read_managed_rows_for_channel (std::string channel_name, std::vector< RPL_FAILOVER_MANAGED_TUPLE > &rows)
 Read rows and fields from replication_asynchronous_connection_failover_managed table and returns its details in provided RPL_FAILOVER_MANAGED_TUPLE tuple. More...
 
std::tuple< bool, std::vector< RPL_FAILOVER_SOURCE_TUPLE > > read_source_all_rows ()
 Read all sources. More...
 
std::tuple< bool, std::vector< RPL_FAILOVER_SOURCE_TUPLE > > read_source_random_rows ()
 Get all sources using random scan (ha_rnd_next) to fetch all the rows. More...
 
bool read_managed_random_rows (std::vector< RPL_FAILOVER_MANAGED_TUPLE > &rows)
 Read rows and fields from replication_asynchronous_connection_failover_managed table and returns its details in provided RPL_FAILOVER_MANAGED_TUPLE tuple. More...
 

Static Public Member Functions

static std::tuple< bool, std::string > add_source_skip_send (const std::string &channel, const std::string &host, uint port, const std::string &network_namespace, uint weight, const std::string &managed_name, Rpl_sys_table_access &table_op)
 Insert row for a unmanaged sender on replication_asynchronous_connection_failover table. More...
 
static std::tuple< bool, std::string > add_managed_skip_send (const std::string &channel, const std::string &managed_type, const std::string &managed_name, const Json_wrapper &wrapper, Rpl_sys_table_access &table_op)
 Insert row on replication_asynchronous_connection_failover_managed table. More...
 
static std::tuple< bool, std::vector< RPL_FAILOVER_SOURCE_TUPLE > > read_source_all_rows_internal (Rpl_sys_table_access &table_op)
 Read all sources. More...
 
static bool read_managed_random_rows_internal (Rpl_sys_table_access &table_op, std::vector< RPL_FAILOVER_MANAGED_JSON_TUPLE > &rows)
 Read rows and fields from replication_asynchronous_connection_failover_managed table and returns its details in provided RPL_FAILOVER_MANAGED_JSON_TUPLE tuple. More...
 
static bool read_managed_random_rows_internal (Rpl_sys_table_access &table_op, std::vector< RPL_FAILOVER_MANAGED_TUPLE > &rows)
 Read rows and fields from replication_asynchronous_connection_failover_managed table and returns its details in provided RPL_FAILOVER_MANAGED_TUPLE tuple. More...
 
template<class TUP >
static void get_data (Rpl_sys_table_access &table_op, TUP &rows)
 Get stored data in table. More...
 

Static Public Attributes

static const MYSQL_LEX_CSTRING Primary_weight_key
 
static const MYSQL_LEX_CSTRING Secondary_weight_key
 

Static Private Member Functions

template<class T >
static std::tuple< bool, std::string > execute_handler_func_skip_send (const std::vector< uint > &field_index, const std::vector< std::string > &field_name, const T &field_value, std::function< void(Rpl_sys_table_access &, bool &, std::string &, uint &, key_part_map &)> func, uint table_index, key_part_map keypart_map, Rpl_sys_table_access &table_op)
 A wrapper template function to save/delete data to given table. More...
 
template<class T >
static std::tuple< bool, std::string > execute_handler_func_send (const std::string &db_name, const std::string &table_name, uint num_field, enum thr_lock_type lock_type, const std::vector< uint > &field_index, const std::vector< std::string > &field_name, const T &field_value, std::function< void(Rpl_sys_table_access &, bool &, std::string &, uint &, key_part_map &)> func, uint table_index, key_part_map keypart_map)
 A wrapper template function to save/delete data to given table, and send stored table data to its group replication group members. More...
 

Private Attributes

enum thr_lock_type m_lock_type
 
const std::string m_db {"mysql"}
 
const std::string m_table_failover
 
const uint m_table_failover_num_field {6}
 
const std::string m_table_managed
 
const uint m_table_managed_num_field {4}
 

Constructor & Destructor Documentation

◆ Rpl_async_conn_failover_table_operations()

Rpl_async_conn_failover_table_operations::Rpl_async_conn_failover_table_operations ( enum thr_lock_type  lock_type = TL_WRITE)
inline

Construction.

Parameters
[in]lock_typeHow to lock the table

◆ ~Rpl_async_conn_failover_table_operations()

virtual Rpl_async_conn_failover_table_operations::~Rpl_async_conn_failover_table_operations ( )
virtualdefault

Member Function Documentation

◆ add_managed()

std::tuple< bool, std::string > Rpl_async_conn_failover_table_operations::add_managed ( const std::string &  channel,
const std::string &  host,
uint  port,
const std::string &  network_namespace,
const std::string &  managed_type,
const std::string &  managed_name,
uint  primary_weight,
uint  secondary_weight 
)

Insert row on replication_asynchronous_connection_failover_managed and replication_asynchronous_connection_failover tables, and send stored table data to its group replication group members.

Parameters
[in]channelchannel
[in]hostsender host
[in]portsender port
[in]network_namespacesender network_namespace
[in]managed_typeDetermines the manged group type.
[in]managed_nameThe name of the group which this server belongs to
[in]primary_weightweight assigned to the primary
[in]secondary_weightweight assigned to the secondary
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.

◆ add_managed_skip_send()

std::tuple< bool, std::string > Rpl_async_conn_failover_table_operations::add_managed_skip_send ( const std::string &  channel,
const std::string &  managed_type,
const std::string &  managed_name,
const Json_wrapper wrapper,
Rpl_sys_table_access table_op 
)
static

Insert row on replication_asynchronous_connection_failover_managed table.

Parameters
[in]channelchannel
[in]managed_typeDetermines the manged group type.
[in]managed_nameThe name of the group which this server belongs to.
[in]wrappercontains weight assigned to the primary and secondary member in Json format.
[in]table_opRpl_sys_table_access class object.
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.

◆ add_source()

std::tuple< bool, std::string > Rpl_async_conn_failover_table_operations::add_source ( const std::string &  channel,
const std::string &  host,
uint  port,
const std::string &  network_namespace,
uint  weight,
const std::string &  managed_name 
)

Insert row for a unmanaged sender on replication_asynchronous_connection_failover table, and send stored table data to its group replication group members.

Parameters
[in]channelchannel
[in]hostsender host
[in]portsender port
[in]network_namespacesender network_namespace
[in]weightsender weight
[in]managed_nameThe name of the group which this server belongs to.
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.

◆ add_source_skip_send()

std::tuple< bool, std::string > Rpl_async_conn_failover_table_operations::add_source_skip_send ( const std::string &  channel,
const std::string &  host,
uint  port,
const std::string &  network_namespace,
uint  weight,
const std::string &  managed_name,
Rpl_sys_table_access table_op 
)
static

Insert row for a unmanaged sender on replication_asynchronous_connection_failover table.

Parameters
[in]channelchannel
[in]hostsender host
[in]portsender port
[in]network_namespacesender network_namespace
[in]weightsender weight
[in]managed_nameThe name of the group which this server belongs to.
[in]table_opRpl_sys_table_access class object.
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.

◆ delete_managed()

std::tuple< bool, std::string > Rpl_async_conn_failover_table_operations::delete_managed ( const std::string &  channel,
const std::string &  managed_name 
)

Delete row on replication_asynchronous_connection_failover_managed table and all its sources on replication_asynchronous_connection_failover table.

Parameters
[in]channelThe asynchronous replication channel name
[in]managed_nameThe name of the group which this server belongs to.
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.

◆ delete_source()

std::tuple< bool, std::string > Rpl_async_conn_failover_table_operations::delete_source ( const std::string &  channel,
const std::string &  host,
uint  port,
const std::string &  network_namespace 
)

Delete row for a unmanaged sender on replication_asynchronous_connection_failover table.

Parameters
[in]channelchannel
[in]hostsender host
[in]portsender port
[in]network_namespacesender network_namespace
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.

◆ execute_handler_func_send()

template<class T >
std::tuple< bool, std::string > Rpl_async_conn_failover_table_operations::execute_handler_func_send ( const std::string &  db_name,
const std::string &  table_name,
uint  num_field,
enum thr_lock_type  lock_type,
const std::vector< uint > &  field_index,
const std::vector< std::string > &  field_name,
const T &  field_value,
std::function< void(Rpl_sys_table_access &, bool &, std::string &, uint &, key_part_map &)>  func,
uint  table_index,
key_part_map  keypart_map 
)
staticprivate

A wrapper template function to save/delete data to given table, and send stored table data to its group replication group members.

Parameters
[in]db_nameThe database whose table will be used to write/delete data.
[in]table_nameThe table to which data will be written or deleted.
[in]num_fieldThe number of fields to be written or match while querying for delete operations.
[in]lock_typeHow to lock the table
[in]field_indexThe list of field's position to be written or match while querying for delete operations.
[in]field_nameThe list of field names of the table.
[in]field_valueThe field values to be written or match while querying for delete operations.
[in]funcThe handler class function to write/delete data.
[in]table_indexThe table index/key position (by default i.e. on position 0, if primary key present is used).
[in]keypart_mapWhich part of key to use.
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.

◆ execute_handler_func_skip_send()

template<class T >
std::tuple< bool, std::string > Rpl_async_conn_failover_table_operations::execute_handler_func_skip_send ( const std::vector< uint > &  field_index,
const std::vector< std::string > &  field_name,
const T &  field_value,
std::function< void(Rpl_sys_table_access &, bool &, std::string &, uint &, key_part_map &)>  func,
uint  table_index,
key_part_map  keypart_map,
Rpl_sys_table_access table_op 
)
staticprivate

A wrapper template function to save/delete data to given table.

Parameters
[in]field_indexThe list of field's position to be written or match while querying for delete operations.
[in]field_nameThe list of field names of the table.
[in]field_valueThe field values to be written or match while querying for delete operations.
[in]funcThe handler class function to write/delete data.
[in]table_indexThe table index/key position (by default i.e. on position 0, if primary key present is used).
[in]keypart_mapWhich part of key to use.
[in]table_opRpl_sys_table_access class object.
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_data()

template<class TUP >
void Rpl_async_conn_failover_table_operations::get_data ( Rpl_sys_table_access table_op,
TUP &  rows 
)
static

Get stored data in table.

Parameters
[in]table_opRpl_sys_table_access class object.
[out]rowsFetch and store read rows in the tuple.

◆ read_managed_random_rows()

bool Rpl_async_conn_failover_table_operations::read_managed_random_rows ( std::vector< RPL_FAILOVER_MANAGED_TUPLE > &  rows)

Read rows and fields from replication_asynchronous_connection_failover_managed table and returns its details in provided RPL_FAILOVER_MANAGED_TUPLE tuple.

It uses random scan (ha_rnd_next) to fetch all the rows.

Parameters
[out]rowsreturn rows read from replication_asynchronous_connection_failover_managed
Returns
function return value which determines if read was: false Successful true Error

◆ read_managed_random_rows_internal() [1/2]

bool Rpl_async_conn_failover_table_operations::read_managed_random_rows_internal ( Rpl_sys_table_access table_op,
std::vector< RPL_FAILOVER_MANAGED_JSON_TUPLE > &  rows 
)
static

Read rows and fields from replication_asynchronous_connection_failover_managed table and returns its details in provided RPL_FAILOVER_MANAGED_JSON_TUPLE tuple.

It uses random scan (ha_rnd_next) to fetch all the rows.

Parameters
[in]table_opRpl_sys_table_access class object.
[out]rowsreturn rows read from replication_asynchronous_connection_failover_managed
Returns
function return value which determines if read was: false Successful true Error

◆ read_managed_random_rows_internal() [2/2]

bool Rpl_async_conn_failover_table_operations::read_managed_random_rows_internal ( Rpl_sys_table_access table_op,
std::vector< RPL_FAILOVER_MANAGED_TUPLE > &  rows 
)
static

Read rows and fields from replication_asynchronous_connection_failover_managed table and returns its details in provided RPL_FAILOVER_MANAGED_TUPLE tuple.

It uses random scan (ha_rnd_next) to fetch all the rows.

Parameters
[in]table_opRpl_sys_table_access class object.
[out]rowsreturn rows read from replication_asynchronous_connection_failover_managed
Returns
function return value which determines if read was: false Successful true Error

◆ read_managed_rows_for_channel()

bool Rpl_async_conn_failover_table_operations::read_managed_rows_for_channel ( std::string  channel_name,
std::vector< RPL_FAILOVER_MANAGED_TUPLE > &  rows 
)

Read rows and fields from replication_asynchronous_connection_failover_managed table and returns its details in provided RPL_FAILOVER_MANAGED_TUPLE tuple.

It uses index scan (ha_index_read_idx_map) to fetch rows for the channel name.

Parameters
[in]channel_nameThe channel name
[out]rowsreturn rows read from replication_asynchronous_connection_failover_managed
Returns
function return value which determines if read was: false Successful true Error

◆ read_source_all_rows()

std::tuple< bool, std::vector< RPL_FAILOVER_SOURCE_TUPLE > > Rpl_async_conn_failover_table_operations::read_source_all_rows ( )

Read all sources.

It uses index scan (ha_index_first) to fetch all the rows.

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 is list of return details based on open table and template provided.

◆ read_source_all_rows_internal()

std::tuple< bool, std::vector< RPL_FAILOVER_SOURCE_TUPLE > > Rpl_async_conn_failover_table_operations::read_source_all_rows_internal ( Rpl_sys_table_access table_op)
static

Read all sources.

It uses index scan (ha_index_first) to fetch all the rows.

Parameters
[in]table_opRpl_sys_table_access class object.
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 is list of return details based on open table and template provided.

◆ read_source_random_rows()

std::tuple< bool, std::vector< RPL_FAILOVER_SOURCE_TUPLE > > Rpl_async_conn_failover_table_operations::read_source_random_rows ( )

Get all sources using random scan (ha_rnd_next) to fetch all the rows.

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 is list of return details based on open table and template provided.

◆ read_source_rows_for_channel()

std::tuple< bool, std::vector< RPL_FAILOVER_SOURCE_TUPLE > > Rpl_async_conn_failover_table_operations::read_source_rows_for_channel ( std::string  channel_name)

Read all sources for a channel.

It uses index scan (ha_index_read_idx_map) to fetch rows for the channel name.

Parameters
[in]channel_nameThe channel name
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 is list of return details based on open table and template provided.

◆ read_source_rows_for_channel_and_managed_name()

std::tuple< bool, std::vector< RPL_FAILOVER_SOURCE_TUPLE > > Rpl_async_conn_failover_table_operations::read_source_rows_for_channel_and_managed_name ( std::string  channel_name,
std::string  managed_name 
)

Real all sources for a channel and a managed name.

It uses index scan (ha_index_read_idx_map) to fetch rows for the channel name and manged name.

Parameters
[in]channel_nameThe channel name
[in]managed_nameThe name of the group which this server belongs to.
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 is list of return details based on open table and template provided.

◆ reset()

bool Rpl_async_conn_failover_table_operations::reset ( void  )

Delete all rows on replication_asynchronous_connection_failover_managed and replication_asynchronous_connection_failover tables, and delete its respective rows on replication_group_configuration_version table.

Returns
operation status: false Successful true Error

Member Data Documentation

◆ m_db

const std::string Rpl_async_conn_failover_table_operations::m_db {"mysql"}
private

◆ m_lock_type

enum thr_lock_type Rpl_async_conn_failover_table_operations::m_lock_type
private

◆ m_table_failover

const std::string Rpl_async_conn_failover_table_operations::m_table_failover
private
Initial value:
{
"replication_asynchronous_connection_failover"}

◆ m_table_failover_num_field

const uint Rpl_async_conn_failover_table_operations::m_table_failover_num_field {6}
private

◆ m_table_managed

const std::string Rpl_async_conn_failover_table_operations::m_table_managed
private
Initial value:
{
"replication_asynchronous_connection_failover_managed"}

◆ m_table_managed_num_field

const uint Rpl_async_conn_failover_table_operations::m_table_managed_num_field {4}
private

◆ Primary_weight_key

const MYSQL_LEX_CSTRING Rpl_async_conn_failover_table_operations::Primary_weight_key
static
Initial value:
= {
STRING_WITH_LEN("Primary_weight")}
#define STRING_WITH_LEN(X)
Definition: string_with_len.h:28

◆ Secondary_weight_key

const MYSQL_LEX_CSTRING Rpl_async_conn_failover_table_operations::Secondary_weight_key
static
Initial value:
= {
STRING_WITH_LEN("Secondary_weight")}

The documentation for this class was generated from the following files: