MySQL 8.0.39
Source Code Documentation
|
The class is a container for all the per-channel filters, both a map of Rpl_filter objects and a list of Rpl_pfs_filter objects. More...
#include <rpl_msr.h>
Public Member Functions | |
Rpl_filter * | create_filter (const char *channel_name) |
Create a new replication filter and add it into a filter map. More... | |
void | delete_filter (Rpl_filter *rpl_filter) |
Delete the replication filter from the filter map. More... | |
void | discard_all_unattached_filters () |
Discard all replication filters if they are not attached to channels. More... | |
void | discard_group_replication_filters () |
discard filters on group replication channels. More... | |
Rpl_filter * | get_channel_filter (const char *channel_name) |
Get a replication filter of a channel. More... | |
void | reset_pfs_view () |
This member function is called every time a filter is created or deleted, or its filter rules are changed. More... | |
Rpl_pfs_filter * | get_filter_at_pos (uint pos) |
Used only by replication performance schema indices to get the replication filter at the position 'pos' from the rpl_pfs_filter_vec vector. More... | |
uint | get_filter_count () |
Used only by replication performance schema indices to get the count of replication filters from the rpl_pfs_filter_vec vector. More... | |
bool | build_do_and_ignore_table_hashes () |
Traverse the filter map, build do_table and ignore_table rules to hashes for every filter. More... | |
Rpl_channel_filters () | |
~Rpl_channel_filters () | |
void | clean_up () |
Traverse the filter map and free all filters. More... | |
void | wrlock () |
Acquire the write lock. More... | |
void | rdlock () |
Acquire the read lock. More... | |
void | unlock () |
Release the lock (whether it is a write or read lock). More... | |
Private Attributes | |
filter_map | channel_to_filter |
std::vector< Rpl_pfs_filter > | rpl_pfs_filter_vec |
Checkable_rwlock * | m_channel_to_filter_lock |
The class is a container for all the per-channel filters, both a map of Rpl_filter objects and a list of Rpl_pfs_filter objects.
It maintains a filter map which maps a replication filter to a channel name. Which is needed, because replication channels are not created and channel_map is not filled in when these global and per-channel replication filters are evaluated with current code frame. In theory, after instantiating all channels from the repository and throwing all the warnings about the filters configured for non-existent channels, we can forget about its global object rpl_channel_filters and rely only on the global and per channel Rpl_filter objects. But to avoid holding the channel_map.rdlock() when querying P_S.replication_applier_filters table, we keep the rpl_channel_filters. So that we just need to hold the small rpl_channel_filters.rdlock() when querying P_S.replication_applier_filters table. Many operations (RESET SLAVE [FOR CHANNEL], START SLAVE, INIT SLAVE, END SLAVE, CHANGE MASTER TO, FLUSH RELAY LOGS, START CHANNEL, PURGE CHANNEL, and so on) hold the channel_map.wrlock().
There is one instance, rpl_channel_filters, created globally for Multisource channel filters. The rpl_channel_filters is created when the server is started, destroyed when the server is stopped.
|
inline |
|
inline |
bool Rpl_channel_filters::build_do_and_ignore_table_hashes | ( | ) |
Traverse the filter map, build do_table and ignore_table rules to hashes for every filter.
0 | OK |
-1 | Error |
|
inline |
Traverse the filter map and free all filters.
Delete all objects in the rpl_pfs_filter_vec vector and then clear the vector.
Rpl_filter * Rpl_channel_filters::create_filter | ( | const char * | channel_name | ) |
Create a new replication filter and add it into a filter map.
channel_name | A name of a channel. |
Rpl_filter | A pointer to a replication filter, or NULL if we failed to add it into fiter_map. |
void Rpl_channel_filters::delete_filter | ( | Rpl_filter * | rpl_filter | ) |
Delete the replication filter from the filter map.
rpl_filter | A pointer to point to a replication filter. |
void Rpl_channel_filters::discard_all_unattached_filters | ( | ) |
Discard all replication filters if they are not attached to channels.
void Rpl_channel_filters::discard_group_replication_filters | ( | ) |
discard filters on group replication channels.
Rpl_filter * Rpl_channel_filters::get_channel_filter | ( | const char * | channel_name | ) |
Get a replication filter of a channel.
channel_name | A name of a channel. |
Rpl_filter | A pointer to a replication filter, or NULL if we failed to add a replication filter into fiter_map when creating it. |
Rpl_pfs_filter * Rpl_channel_filters::get_filter_at_pos | ( | uint | pos | ) |
Used only by replication performance schema indices to get the replication filter at the position 'pos' from the rpl_pfs_filter_vec vector.
pos | the index in the rpl_pfs_filter_vec vector. |
Rpl_filter | A pointer to a Rpl_pfs_filter, or NULL if it arrived the end of the rpl_pfs_filter_vec. |
uint Rpl_channel_filters::get_filter_count | ( | ) |
Used only by replication performance schema indices to get the count of replication filters from the rpl_pfs_filter_vec vector.
the | count of the replication filters. |
|
inline |
Acquire the read lock.
void Rpl_channel_filters::reset_pfs_view | ( | ) |
This member function is called every time a filter is created or deleted, or its filter rules are changed.
Once that happens the PFS view is recreated.
|
inline |
Release the lock (whether it is a write or read lock).
|
inline |
Acquire the write lock.
|
private |
|
private |
|
private |