54typedef std::map<std::string, Master_info *>
mi_map;
88template <std::forward_iterator Outer_iterator_t,
bool outer_is_map,
97 static auto &
mapped_value(
const Outer_iterator_t &outer_iterator) {
98 if constexpr (outer_is_map)
99 return outer_iterator->second;
101 return *outer_iterator;
111 if constexpr (inner_is_map)
112 return inner_iterator->second;
114 return *inner_iterator;
138 const Outer_iterator_t &outer_end,
164 constexpr decltype(
auto)
operator*()
const {
226template <
class Nested_map_t,
bool outer_is_map,
bool inner_is_map>
229 outer_is_map, inner_is_map>;
325#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
346 static int instance_count = 0;
348 assert(instance_count == 1);
352#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
414 bool delete_mi(
const char *channel_name);
434 replication_channel_map::iterator map_it;
441 count += map_it->second.size();
451 return map_it->second.size();
467 replication_channel_map::iterator map_it =
470 for (mi_map::iterator it = map_it->second.begin();
471 it != map_it->second.end(); it++) {
532 return mi && (mi->
host[0] ||
545 replication_channel_map::iterator map_it;
549 return map_it->second.begin();
552 return end(channel_type);
557 replication_channel_map::iterator map_it;
561 return map_it->second.end();
578#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
743#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
802 if (it->second !=
nullptr) {
804 it->second =
nullptr;
This has the functionality of mysql_rwlock_t, with two differences:
Definition: rpl_gtid.h:325
int trywrlock()
Return 0 if the write lock is held, otherwise an error will be returned.
Definition: rpl_gtid.h:538
void rdlock()
Acquire the read lock.
Definition: rpl_gtid.h:486
void wrlock()
Acquire the write lock.
Definition: rpl_gtid.h:495
int tryrdlock()
Return 0 if the read lock is held, otherwise an error will be returned.
Definition: rpl_gtid.h:557
void assert_some_lock() const
Assert that some thread holds either the read or the write lock.
Definition: rpl_gtid.h:572
void unlock()
Release the lock (whether it is a write or read lock).
Definition: rpl_gtid.h:506
void assert_some_wrlock() const
Assert that some thread holds the write lock.
Definition: rpl_gtid.h:576
Iterator that provides the elements of a nested map as a linear sequence.
Definition: rpl_msr.h:90
decltype(mapped_value(Outer_iterator_t())) Inner_map_t
Definition: rpl_msr.h:104
std::ptrdiff_t difference_type
Definition: rpl_msr.h:119
static auto & mapped_value(const Outer_iterator_t &outer_iterator)
Definition: rpl_msr.h:97
constexpr Self_t & operator++()
Pre-increment.
Definition: rpl_msr.h:150
Outer_iterator_t m_outer_end
End of outer map.
Definition: rpl_msr.h:199
constexpr Denested_map_iterator(const Outer_iterator_t &outer_begin, const Outer_iterator_t &outer_end, bool at_end)
Constructor.
Definition: rpl_msr.h:137
Outer_iterator_t m_outer_begin
Beginning of outer map.
Definition: rpl_msr.h:196
Iterator_for< Inner_map_t > Inner_iterator_t
Definition: rpl_msr.h:105
decltype(mapped_value(Inner_iterator_t())) value_type
Definition: rpl_msr.h:118
Outer_iterator_t m_outer_it
Iterator to the outer map.
Definition: rpl_msr.h:202
constexpr void skip_inner_end_positions()
Maintain the invariant that either m_outer_it points to the end, or m_inner_it doesn't point to the e...
Definition: rpl_msr.h:185
Inner_iterator_t m_inner_it
Iterator to the inner map, or undefined if the outer map points to the end.
Definition: rpl_msr.h:206
constexpr Self_t operator++(int)
Post-increment.
Definition: rpl_msr.h:157
constexpr bool operator==(const Self_t &other) const
Comparison.
Definition: rpl_msr.h:169
Denested_map_iterator()=default
Default constructor.
static auto & mapped_value(const Inner_iterator_t &inner_iterator)
Definition: rpl_msr.h:110
View over a nested map structure, which provides iterators over the elements of the second-level map.
Definition: rpl_msr.h:227
auto begin() const
Definition: rpl_msr.h:236
Denested_map_iterator< Iterator_for< Nested_map_t >, outer_is_map, inner_is_map > Iterator_t
Definition: rpl_msr.h:229
auto end()
Definition: rpl_msr.h:235
auto begin()
Definition: rpl_msr.h:234
Denested_map_view(Nested_map_t &map)
Definition: rpl_msr.h:232
Nested_map_t * m_map
Definition: rpl_msr.h:240
auto end() const
Definition: rpl_msr.h:237
bool is_source_connection_auto_failover()
Checks if Asynchronous Replication Connection Failover feature is enabled.
Definition: rpl_mi.h:542
static bool is_configured(Master_info *mi)
Definition: rpl_mi.h:109
char host[HOSTNAME_LENGTH+1]
Host name or ip address stored in the master.info.
Definition: rpl_mi.h:99
Class to store all the Master_info objects of a slave to access them in the replication code base or ...
Definition: rpl_msr.h:298
Master_info * get_mi_at_pos(uint pos)
Used only by replication performance schema indices to get the master_info at the position 'pos' from...
Definition: rpl_msr.cc:231
bool add_mi_to_rpl_pfs_mi(Master_info *mi)
Add a master info pointer to the rpl_pfs_mi array at the first NULL;.
Definition: rpl_msr.cc:200
Multisource_info()
Definition: rpl_msr.h:340
size_t get_number_of_connection_auto_failover_channels_running()
Get the number of running channels which have asynchronous replication failover feature,...
Definition: rpl_msr.h:462
mi_map::iterator end(enum_channel_type channel_type=SLAVE_REPLICATION_CHANNEL)
Definition: rpl_msr.h:555
void assert_some_lock() const
Assert that some thread holds either the read or the write lock.
Definition: rpl_msr.h:650
static const char * group_replication_channel_names[]
Definition: rpl_msr.h:315
void wrlock()
Acquire the write lock.
Definition: rpl_msr.h:632
static const char * default_channel
Default_channel for this instance, currently is predefined and cannot be modified.
Definition: rpl_msr.h:313
int trywrlock()
Try to acquire a write lock, return 0 if the write lock is held, otherwise an error will be returned.
Definition: rpl_msr.h:640
Master_info * get_default_channel_mi()
Return the master_info object corresponding to the default channel.
Definition: rpl_msr.h:394
int get_index_from_rpl_pfs_mi(const char *channel_name)
Get the index of the master info corresponding to channel name from the rpl_pfs_mi array.
Definition: rpl_msr.cc:218
uint get_max_channels()
Get max channels allowed for this map.
Definition: rpl_msr.h:495
void init_rpl_pfs_mi()
Definition: rpl_msr.h:581
Checkable_rwlock * m_channel_map_lock
This lock was designed to protect the channel_map from adding or removing master_info objects from th...
Definition: rpl_msr.h:323
Master_info * default_channel_mi
Definition: rpl_msr.h:314
uint current_mi_count
Definition: rpl_msr.h:307
static bool is_group_replication_applier_channel_name(const char *channel)
Checks if a channel is the group replication applier channel.
Definition: rpl_msr.cc:183
bool delete_mi(const char *channel_name)
Remove the entry corresponding to the channel, from the replication_channel_map and sets index in the...
Definition: rpl_msr.cc:117
static bool is_group_replication_recovery_channel_name(const char *channel)
Checks if a channel is the group replication recovery channel.
Definition: rpl_msr.cc:188
~Multisource_info()
Definition: rpl_msr.h:364
auto all_channels_view()
Definition: rpl_msr.h:567
void rdlock()
Acquire the read lock.
Definition: rpl_msr.h:619
static bool is_group_replication_channel_name(const char *channel)
Returns if a channel name is one of the reserved group replication names.
Definition: rpl_msr.cc:193
void assert_some_wrlock() const
Assert that some thread holds the write lock.
Definition: rpl_msr.h:657
bool add_mi(const char *channel_name, Master_info *mi)
Adds the Master_info object to both replication_channel_map and rpl_pfs_mi.
Definition: rpl_msr.cc:41
void unlock()
Release the lock (whether it is a write or read lock).
Definition: rpl_msr.h:645
mi_map::iterator begin(enum_channel_type channel_type=SLAVE_REPLICATION_CHANNEL)
Forward iterators to initiate traversing of a map.
Definition: rpl_msr.h:543
auto all_channels_view() const
Definition: rpl_msr.h:572
Master_info * get_mi(const char *channel_name)
Find the master_info object corresponding to a channel explicitly from replication channel_map; Retur...
Definition: rpl_msr.cc:86
bool is_valid_channel_count()
Returns true if the current number of channels in this slave is less than the MAX_CHANNLES.
Definition: rpl_msr.h:501
const char * get_default_channel()
Get the default channel for this multisourced_slave;.
Definition: rpl_msr.h:419
int tryrdlock()
Try to acquire a read lock, return 0 if the read lock is held, otherwise an error will be returned.
Definition: rpl_msr.h:627
Master_info * rpl_pfs_mi[MAX_CHANNELS]
Definition: rpl_msr.h:328
replication_channel_map rep_channel_map
Definition: rpl_msr.h:304
static bool is_channel_configured(const Master_info *mi)
Check if the channel has an hostname or is a GR channel.
Definition: rpl_msr.h:531
mi_map empty_mi_map
Definition: rpl_msr.h:336
static const unsigned int MAX_CHANNELS
Definition: rpl_msr.h:301
size_t get_num_instances(bool all=false)
Get the number of instances of Master_info in the map.
Definition: rpl_msr.h:429
The class is a container for all the per-channel filters, both a map of Rpl_filter objects and a list...
Definition: rpl_msr.h:684
Checkable_rwlock * m_channel_to_filter_lock
Definition: rpl_msr.h:706
uint get_filter_count()
Used only by replication performance schema indices to get the count of replication filters from the ...
Definition: rpl_msr.cc:388
Rpl_pfs_filter * get_filter_at_pos(uint pos)
Used only by replication performance schema indices to get the replication filter at the position 'po...
Definition: rpl_msr.cc:378
Rpl_filter * get_channel_filter(const char *channel_name)
Get a replication filter of a channel.
Definition: rpl_msr.cc:340
std::vector< Rpl_pfs_filter > rpl_pfs_filter_vec
Definition: rpl_msr.h:689
void reset_pfs_view()
This member function is called every time a filter is created or deleted, or its filter rules are cha...
Definition: rpl_msr.cc:363
void clean_up()
Traverse the filter map and free all filters.
Definition: rpl_msr.h:798
void unlock()
Release the lock (whether it is a write or read lock).
Definition: rpl_msr.h:824
void delete_filter(Rpl_filter *rpl_filter)
Delete the replication filter from the filter map.
Definition: rpl_msr.cc:270
void discard_group_replication_filters()
discard filters on group replication channels.
Definition: rpl_msr.cc:291
void discard_all_unattached_filters()
Discard all replication filters if they are not attached to channels.
Definition: rpl_msr.cc:309
Rpl_channel_filters()
Definition: rpl_msr.h:783
bool build_do_and_ignore_table_hashes()
Traverse the filter map, build do_table and ignore_table rules to hashes for every filter.
Definition: rpl_msr.cc:397
filter_map channel_to_filter
Definition: rpl_msr.h:687
Rpl_filter * create_filter(const char *channel_name)
Create a new replication filter and add it into a filter map.
Definition: rpl_msr.cc:241
~Rpl_channel_filters()
Definition: rpl_msr.h:792
void wrlock()
Acquire the write lock.
Definition: rpl_msr.h:814
void rdlock()
Acquire the read lock.
Definition: rpl_msr.h:819
Rpl_filter.
Definition: rpl_filter.h:214
char * get_channel() const
Definition: rpl_info.h:125
std::atomic< uint > slave_running
Definition: rpl_info.h:82
The class Rpl_pfs_filter is introduced to serve the performance_schema.replication_applier_filters ta...
Definition: rpl_filter.h:167
mysql_mutex_t err_lock
lock used to synchronize m_last_error on 'SHOW REPLICA STATUS'
Definition: rpl_reporting.h:57
bool is_error() const
Definition: rpl_reporting.h:144
static Source_IO_monitor * get_instance()
Fetch Source_IO_monitor class instance.
Definition: rpl_io_monitor.cc:1092
#define mysql_mutex_lock(M)
Definition: mysql_mutex.h:50
#define mysql_mutex_unlock(M)
Definition: mysql_mutex.h:57
#define DBUG_EXECUTE_IF(keyword, a1)
Definition: my_dbug.h:171
#define DBUG_TRACE
Definition: my_dbug.h:146
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
#define HAVE_PSI_INTERFACE
Definition: my_psi_config.h:39
static int count
Definition: myisam_ftdump.cc:45
PSI_rwlock_key key_rwlock_channel_to_filter_lock
Definition: mysqld.cc:13884
PSI_rwlock_key key_rwlock_channel_map_lock
Definition: mysqld.cc:13880
bool is_valid(const dd::Spatial_reference_system *srs, const Geometry *g, const char *func_name, bool *is_valid) noexcept
Decides if a geometry is valid.
Definition: is_valid.cc:95
const char * begin(const char *const c)
Definition: base64.h:44
Definition: gcs_xcom_synode.h:64
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2894
enum_channel_type
Types of channels.
Definition: rpl_channel_service_interface.h:51
@ SLAVE_REPLICATION_CHANNEL
Definition: rpl_channel_service_interface.h:52
decltype(std::begin(std::declval< T >())) Iterator_for
Definition: rpl_msr.h:64
std::map< std::string, Master_info * > mi_map
Maps a channel name to it's Master_info.
Definition: rpl_msr.h:47
static bool is_slave_configured()
Definition: rpl_msr.h:833
std::map< std::string, Rpl_filter * > filter_map
Definition: rpl_msr.h:58
Multisource_info channel_map
Definition: rpl_msr.cc:418
std::map< int, mi_map > replication_channel_map
Definition: rpl_msr.h:56
Rpl_channel_filters rpl_channel_filters
Definition: rpl_msr.cc:420