MySQL 9.1.0
Source Code Documentation
|
Rpl_filter. More...
#include <rpl_filter.h>
Public Types | |
typedef int(Rpl_filter::* | Add_filter) (char const *) |
Public Member Functions | |
Rpl_filter () | |
virtual | ~Rpl_filter () |
Rpl_filter (Rpl_filter const &) | |
Rpl_filter & | operator= (Rpl_filter const &) |
bool | tables_ok (const char *db, Table_ref *tables) |
bool | db_ok (const char *db, bool need_increase_counter=true) |
bool | db_ok_with_wild_table (const char *db) |
bool | is_on () |
bool | is_empty () |
Check if the replication filter is empty or not. More... | |
int | copy_global_replication_filters () |
Copy global replication filters to its per-channel replication filters if there are no per-channel replication filters and there are global filters on the filter type on channel creation. More... | |
bool | is_rewrite_empty () |
int | build_do_table_hash () |
int | build_ignore_table_hash () |
int | add_string_list (I_List< i_string > *list, const char *spec) |
int | add_string_pair_list (I_List< i_string_pair > *list, const char *key, const char *val) |
int | add_do_table_array (const char *table_spec) |
int | add_ignore_table_array (const char *table_spec) |
int | add_wild_do_table (const char *table_spec) |
int | add_wild_ignore_table (const char *table_spec) |
int | set_do_db (mem_root_deque< Item * > *list, enum_configured_by configured_by) |
int | set_ignore_db (mem_root_deque< Item * > *list, enum_configured_by configured_by) |
int | set_do_table (mem_root_deque< Item * > *list, enum_configured_by configured_by) |
int | set_ignore_table (mem_root_deque< Item * > *list, enum_configured_by configured_by) |
int | set_wild_do_table (mem_root_deque< Item * > *list, enum_configured_by configured_by) |
int | set_wild_ignore_table (mem_root_deque< Item * > *list, enum_configured_by configured_by) |
int | set_db_rewrite (mem_root_deque< Item * > *list, enum_configured_by configured_by) |
int | parse_filter_list (mem_root_deque< Item * > *item_list, Add_filter func) |
int | parse_filter_list (I_List< i_string > *list, Add_filter add) |
Execute the specified func with elements of the list as input. More... | |
int | add_do_db (const char *db_spec) |
int | add_ignore_db (const char *db_spec) |
int | add_db_rewrite (const char *from_db, const char *to_db) |
void | get_do_table (String *str) |
void | get_ignore_table (String *str) |
void | get_wild_do_table (String *str) |
void | get_wild_ignore_table (String *str) |
const char * | get_rewrite_db (const char *db, size_t *new_len) |
void | get_rewrite_db (String *str) |
I_List< i_string > * | get_do_db () |
void | get_do_db (String *str) |
I_List< i_string > * | get_ignore_db () |
void | get_ignore_db (String *str) |
Rpl_filter_statistics * | get_rewrite_db_statistics () |
void | free_string_list (I_List< i_string > *l) |
void | free_string_pair_list (I_List< i_string_pair > *l) |
void | put_filters_into_vector (std::vector< Rpl_pfs_filter > &rpl_pfs_filter_vec, const char *channel_name) |
Put replication filters with attached channel name into a vector. 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... | |
void | assert_some_wrlock () |
Assert that some thread holds the write lock. More... | |
void | assert_some_rdlock () |
Assert that some thread holds the read lock. More... | |
bool | is_attached () |
Check if the relation between the per-channel filter and the channel's Relay_log_info is established. More... | |
void | set_attached () |
Set attached to true when the relation between the per-channel filter and the channel's Relay_log_info is established. More... | |
void | reset () |
Private Types | |
typedef Prealloced_array< TABLE_RULE_ENT *, 16 > | Table_rule_array |
typedef collation_unordered_map< std::string, unique_ptr_my_free< TABLE_RULE_ENT > > | Table_rule_hash |
Private Member Functions | |
void | init_table_rule_hash (Table_rule_hash **h, bool *h_inited) |
void | init_table_rule_array (Table_rule_array *, bool *a_inited) |
int | add_table_rule_to_array (Table_rule_array *a, const char *table_spec) |
int | add_table_rule_to_hash (Table_rule_hash *h, const char *table_spec, uint len) |
Added one table rule to hash. More... | |
void | free_string_array (Table_rule_array *a) |
void | table_rule_ent_hash_to_str (String *s, Table_rule_hash *h, bool inited) |
int | table_rule_ent_hash_to_array (Table_rule_array *table_array, Table_rule_hash *h, bool inited) |
Builds a Table_rule_array from a hash of TABLE_RULE_ENT. More... | |
int | table_rule_ent_array_to_array (Table_rule_array *dest_array, Table_rule_array *source_array, bool inited) |
Builds a destination Table_rule_array from a source Table_rule_array of TABLE_RULE_ENT. More... | |
void | table_rule_ent_dynamic_array_to_str (String *s, Table_rule_array *a, bool inited) |
TABLE_RULE_ENT * | find_wild (Table_rule_array *a, const char *key, size_t len) |
int | build_table_hash_from_array (Table_rule_array *table_array, Table_rule_hash **table_hash, bool array_inited, bool *hash_inited) |
Table rules are initially added to DYNAMIC_LIST, and then, when the charset to use for tables has been established, inserted into a hash for faster filter checking. More... | |
Rpl_filter.
Inclusion and exclusion rules of tables and databases. Also handles rewrites of db. Used for replication and binlogging.
typedef int(Rpl_filter::* Rpl_filter::Add_filter) (char const *) |
|
private |
|
private |
Rpl_filter::Rpl_filter | ( | ) |
|
virtual |
Rpl_filter::Rpl_filter | ( | Rpl_filter const & | ) |
int Rpl_filter::add_db_rewrite | ( | const char * | from_db, |
const char * | to_db | ||
) |
int Rpl_filter::add_do_db | ( | const char * | db_spec | ) |
int Rpl_filter::add_do_table_array | ( | const char * | table_spec | ) |
int Rpl_filter::add_ignore_db | ( | const char * | db_spec | ) |
int Rpl_filter::add_ignore_table_array | ( | const char * | table_spec | ) |
int Rpl_filter::add_string_pair_list | ( | I_List< i_string_pair > * | list, |
const char * | key, | ||
const char * | val | ||
) |
|
private |
|
private |
Added one table rule to hash.
[in] | h | hash for storing table rules |
[in] | table_spec | Table name with db |
[in] | len | The length of table_spec |
int Rpl_filter::add_wild_do_table | ( | const char * | table_spec | ) |
int Rpl_filter::add_wild_ignore_table | ( | const char * | table_spec | ) |
|
inline |
Assert that some thread holds the read lock.
|
inline |
Assert that some thread holds the write lock.
int Rpl_filter::build_do_table_hash | ( | ) |
int Rpl_filter::build_ignore_table_hash | ( | ) |
|
private |
Table rules are initially added to DYNAMIC_LIST, and then, when the charset to use for tables has been established, inserted into a hash for faster filter checking.
[in] | table_array | dynamic array stored table rules |
[in] | table_hash | hash for storing table rules |
[in] | array_inited | Table rules are added to dynamic array |
[in] | hash_inited | Table rules are added to hash |
int Rpl_filter::copy_global_replication_filters | ( | ) |
Copy global replication filters to its per-channel replication filters if there are no per-channel replication filters and there are global filters on the filter type on channel creation.
0 | OK |
1 | Error |
bool Rpl_filter::db_ok | ( | const char * | db, |
bool | need_increase_counter = true |
||
) |
bool Rpl_filter::db_ok_with_wild_table | ( | const char * | db | ) |
|
private |
|
private |
void Rpl_filter::free_string_pair_list | ( | I_List< i_string_pair > * | l | ) |
void Rpl_filter::get_do_db | ( | String * | str | ) |
void Rpl_filter::get_do_table | ( | String * | str | ) |
void Rpl_filter::get_ignore_db | ( | String * | str | ) |
void Rpl_filter::get_ignore_table | ( | String * | str | ) |
const char * Rpl_filter::get_rewrite_db | ( | const char * | db, |
size_t * | new_len | ||
) |
void Rpl_filter::get_rewrite_db | ( | String * | str | ) |
|
inline |
void Rpl_filter::get_wild_do_table | ( | String * | str | ) |
void Rpl_filter::get_wild_ignore_table | ( | String * | str | ) |
|
private |
|
private |
|
inline |
Check if the relation between the per-channel filter and the channel's Relay_log_info is established.
true | if the relation is established |
false | if the relation is not established |
bool Rpl_filter::is_empty | ( | ) |
Check if the replication filter is empty or not.
true | if the replication filter is empty. |
false | if the replication filter is not empty. |
bool Rpl_filter::is_on | ( | ) |
bool Rpl_filter::is_rewrite_empty | ( | ) |
Rpl_filter & Rpl_filter::operator= | ( | Rpl_filter const & | ) |
int Rpl_filter::parse_filter_list | ( | I_List< i_string > * | list, |
Add_filter | add | ||
) |
Execute the specified func with elements of the list as input.
list | A list with I_List<i_string> type |
add | A function with Add_filter type |
0 | OK |
1 | Error |
int Rpl_filter::parse_filter_list | ( | mem_root_deque< Item * > * | item_list, |
Add_filter | func | ||
) |
void Rpl_filter::put_filters_into_vector | ( | std::vector< Rpl_pfs_filter > & | rpl_pfs_filter_vec, |
const char * | channel_name | ||
) |
Put replication filters with attached channel name into a vector.
rpl_pfs_filter_vec | the vector. |
channel_name | the name of the channel attached or NULL if there is no channel attached. |
|
inline |
Acquire the read lock.
void Rpl_filter::reset | ( | void | ) |
|
inline |
Set attached to true when the relation between the per-channel filter and the channel's Relay_log_info is established.
int Rpl_filter::set_db_rewrite | ( | mem_root_deque< Item * > * | list, |
enum_configured_by | configured_by | ||
) |
int Rpl_filter::set_do_db | ( | mem_root_deque< Item * > * | list, |
enum_configured_by | configured_by | ||
) |
int Rpl_filter::set_do_table | ( | mem_root_deque< Item * > * | list, |
enum_configured_by | configured_by | ||
) |
int Rpl_filter::set_ignore_db | ( | mem_root_deque< Item * > * | list, |
enum_configured_by | configured_by | ||
) |
int Rpl_filter::set_ignore_table | ( | mem_root_deque< Item * > * | list, |
enum_configured_by | configured_by | ||
) |
int Rpl_filter::set_wild_do_table | ( | mem_root_deque< Item * > * | list, |
enum_configured_by | configured_by | ||
) |
int Rpl_filter::set_wild_ignore_table | ( | mem_root_deque< Item * > * | list, |
enum_configured_by | configured_by | ||
) |
|
private |
Builds a destination Table_rule_array from a source Table_rule_array of TABLE_RULE_ENT.
dest_array | Pointer to the destination Table_rule_array to fill |
source_array | Pointer to the source Table_rule_array to read |
inited | True if the source Table_rule_array is initialized |
0 | OK |
1 | Error |
|
private |
|
private |
Builds a Table_rule_array from a hash of TABLE_RULE_ENT.
Cannot be used for any other hash, as it assumes that the hash entries are TABLE_RULE_ENT.
table_array | Pointer to the Table_rule_array to fill |
h | Pointer to the hash to read |
inited | True if the hash is initialized |
0 | OK |
1 | Error |
|
private |
bool Rpl_filter::tables_ok | ( | const char * | db, |
Table_ref * | tables | ||
) |
|
inline |
Release the lock (whether it is a write or read lock).
|
inline |
Acquire the write lock.
|
private |
Rpl_filter_statistics Rpl_filter::do_db_statistics |
|
private |
|
private |
|
private |
|
private |
Rpl_filter_statistics Rpl_filter::do_table_statistics |
Rpl_filter_statistics Rpl_filter::ignore_db_statistics |
|
private |
|
private |
|
private |
|
private |
Rpl_filter_statistics Rpl_filter::ignore_table_statistics |
|
private |
|
private |
Rpl_filter_statistics Rpl_filter::rewrite_db_statistics |
|
private |
|
private |
|
private |
Rpl_filter_statistics Rpl_filter::wild_do_table_statistics |
|
private |
|
private |
Rpl_filter_statistics Rpl_filter::wild_ignore_table_statistics |