MySQL  8.0.18
Source Code Documentation
rpl_filter.h
Go to the documentation of this file.
1 /* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef RPL_FILTER_H
24 #define RPL_FILTER_H
25 
26 #include "my_config.h"
27 
28 #include <stddef.h>
29 #include <sys/types.h>
30 #include <atomic>
31 #include <memory>
32 #include <string>
33 #include <vector>
34 
35 #include "map_helpers.h"
36 #include "my_inttypes.h"
37 #include "my_sqlcommand.h"
38 #include "prealloced_array.h" // Prealloced_arrray
39 #include "sql/options_mysqld.h" // options_mysqld
40 #include "sql/rpl_gtid.h"
41 #include "sql/sql_cmd.h" // Sql_cmd
42 #include "sql/sql_list.h" // I_List
43 #include "sql_string.h"
44 
45 class Item;
46 class THD;
47 struct TABLE_LIST;
48 
49 /*
50 There are five classes related to replication filters:
51 - Rpl_filter contains all the seven filters do-db, ignore-db, do-table,
52  ignore-table, wild-do-table, wild-ignore-table, rewrite-db. We
53  instantiate one Rpl_filter for each replication channel and one for
54  the binlog. This contains member functions to apply the filters.
55 - Rpl_pfs_filter has one instance for each row in
56  P_S.replication_applier_filters and one instance for each row of
57  P_S.replication_applier_global_filters.
58 - Rpl_filter_statistics contains the data other than the key for each
59  P_S row. Each Rpl_filter object owns seven instances of this class
60  (one for each filter type) and each Rpl_pfs_filter points to one of
61  those instances.
62 - Rpl_channel_filters contains a map that maps channel names to
63  Rpl_filter objects, as well as a vector that references all
64  the Rpl_pfs_filter objects used to represent
65  P_S.replication_applier_filters.
66 - Rpl_global_filter is a Rpl_filter representing global replication
67  filters, with a vector that references all Rpl_pfs_filter objects
68  used to represent P_S.replication_applier_global_filters table.
69 
70 The vectors of Rpl_pfs_filters objects are rebuilt whenever filters
71 are modified (i.e., channels created/dropped or filters changed).
72 */
73 
75  char *db;
76  char *tbl_name;
78 };
79 
80 /** Enum values for CONFIGURED_BY column. */
86 };
87 
88 /**
89  The class Rpl_filter_statistics encapsulates the following three
90  statistics of replication filter:
91  The configured_by indicates that how the rpl filter is configured.
92  The active_since indicates when the configuration took place.
93  The counter indicates the hit amount of the filter since last
94  configuration.
95  Instances of this class are created in Rpl_filter for each filter
96  type for each channel and the global filter, and have the same
97  life cycle as the instance of Rpl_filter.
98  The reference of this class is used in Rpl_pfs_filter for
99  displaying the three statistics of replication filter in
100  performance_schema.replication_applier_filters table and
101  performance_schema.replication_applier_global_filters table.
102 */
104  public:
107  void reset();
108  /*
109  Set all member variables. The caller just needs to pass argument
110  for configured_by, since counter and active_since are set in the
111  funtion. We do that, since counter must be set to 0 and
112  active_since must be set to current time for any case.
113  */
114  void set_all(enum_configured_by configured_by);
115 
120 
121  private:
122  /*
123  The replication filters can be configured with the following four states:
124  STARTUP_OPTIONS, //STARTUP_OPTIONS: --REPLICATE-*
125  CHANGE_REPLICATION_FILTER, //CHANGE REPLICATION FILTER filter [, filter...]
126  STARTUP_OPTIONS_FOR_CHANNEL, //STARTUP_OPTIONS: --REPLICATE-* (FOR_CHANNEL)
127  CHANGE_REPLICATION_FILTER_FOR_CHANNEL //CHANGE REPLICATION FILTER filter [,
128  filter...] FOR CHANNEL <channel_name>
129  */
131 
132  /* Timestamp of when the configuration took place */
134 
135  /*
136  The hit amount of the filter since last configuration.
137  The m_atomic_counter may be increased by concurrent slave
138  workers, so we use the atomic<uint64>.
139  */
140  std::atomic<uint64> m_atomic_counter{0};
141 
142  /* Prevent user from invoking default constructor function. */
144 
145  /* Prevent user from invoking default assignment function. */
147 };
148 
149 /**
150  The class Rpl_pfs_filter is introduced to serve the
151  performance_schema.replication_applier_filters table
152  and performance_schema.replication_applier_global_filters
153  table to collect data for a row. The class Rpl_filter
154  does not use it directly, since it contains channel_name,
155  which does not belong to Rpl_filter. To decouple code,
156  it depends on Rpl_filter_statistics, does not inherit
157  Rpl_filter_statistics.
158  Instances of this class are created in Rpl_filter for
159  each filter type for each channel and the global filter.
160  Each instance is created when creating, changing or
161  deleting the filter, destroyed when creating, changing
162  or deleting the filter next time.
163 */
165  public:
166  Rpl_pfs_filter();
167  Rpl_pfs_filter(const char *channel_name, const char *filter_name,
168  const String &filter_rule,
169  Rpl_filter_statistics *rpl_filter_statistics);
170  Rpl_pfs_filter(const Rpl_pfs_filter &other);
171  ~Rpl_pfs_filter();
172 
173  const char *get_channel_name() { return m_channel_name; }
174  const char *get_filter_name() { return m_filter_name; }
175  const String &get_filter_rule() { return m_filter_rule; }
178  }
179 
180  private:
181  /* A pointer to the channel name. */
182  const char *m_channel_name;
183 
184  /* A pointer to the filer name. */
185  const char *m_filter_name;
186 
187  /* A pointer to replication filter statistics. */
189 
190  /* A filter rule. */
192 
193  /* Prevent user from invoking default assignment function. */
195 };
196 
197 /**
198  Rpl_filter
199 
200  Inclusion and exclusion rules of tables and databases.
201  Also handles rewrites of db.
202  Used for replication and binlogging.
203  - Instances of this class are created in Rpl_channel_filters
204  for replication filter for each channel. Each instance is
205  created when the channel is configured, destroyed when the
206  channel is removed.
207  - There is one instance, binlog_filter, created for binlog filter.
208  The instance is created when the server is started, destroyed
209  when the server is stopped.
210  */
211 class Rpl_filter {
212  public:
213  Rpl_filter();
214  virtual ~Rpl_filter();
215  Rpl_filter(Rpl_filter const &);
216  Rpl_filter &operator=(Rpl_filter const &);
217 
218  /* Checks - returns true if ok to replicate/log */
219 
220  bool tables_ok(const char *db, TABLE_LIST *tables);
221  bool db_ok(const char *db, bool need_increase_counter = true);
222  bool db_ok_with_wild_table(const char *db);
223 
224  bool is_on();
225  /**
226  Check if the replication filter is empty or not.
227 
228  @retval true if the replication filter is empty.
229  @retval false if the replication filter is not empty.
230  */
231  bool is_empty();
232  /**
233  Copy global replication filters to its per-channel replication filters
234  if there are no per-channel replication filters and there are global
235  filters on the filter type on channel creation.
236 
237  @retval 0 OK
238  @retval 1 Error
239  */
241 
242  bool is_rewrite_empty();
243 
244  /* Setters - add filtering rules */
245  int build_do_table_hash();
247 
248  int add_string_list(I_List<i_string> *list, const char *spec);
250  const char *val);
251  int add_do_table_array(const char *table_spec);
252  int add_ignore_table_array(const char *table_spec);
253 
254  int add_wild_do_table(const char *table_spec);
255  int add_wild_ignore_table(const char *table_spec);
256 
257  int set_do_db(List<Item> *list, enum_configured_by configured_by);
258  int set_ignore_db(List<Item> *list, enum_configured_by configured_by);
259  int set_do_table(List<Item> *list, enum_configured_by configured_by);
260  int set_ignore_table(List<Item> *list, enum_configured_by configured_by);
263  int set_db_rewrite(List<Item> *list, enum_configured_by configured_by);
264  typedef int (Rpl_filter::*Add_filter)(char const *);
265  int parse_filter_list(List<Item> *item_list, Add_filter func);
266  /**
267  Execute the specified func with elements of the list as input.
268 
269  @param list A list with I_List<i_string> type
270  @param add A function with Add_filter type
271 
272  @retval 0 OK
273  @retval 1 Error
274  */
276  int add_do_db(const char *db_spec);
277  int add_ignore_db(const char *db_spec);
278 
279  int add_db_rewrite(const char *from_db, const char *to_db);
280 
281  /* Getters - to get information about current rules */
282 
283  void get_do_table(String *str);
284  void get_ignore_table(String *str);
285 
286  void get_wild_do_table(String *str);
287  void get_wild_ignore_table(String *str);
288 
289  const char *get_rewrite_db(const char *db, size_t *new_len);
290  void get_rewrite_db(String *str);
291 
293  /*
294  Get do_db rule.
295 
296  @param[out] str the db_db rule.
297  */
298  void get_do_db(String *str);
299 
301  /*
302  Get ignore_db rule.
303 
304  @param[out] str the ignore_db rule.
305  */
306  void get_ignore_db(String *str);
307  /*
308  Get rewrite_db_statistics.
309 
310  @retval A pointer to a rewrite_db_statistics object.
311  */
313  return &rewrite_db_statistics;
314  }
315 
318 
319 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
320  /**
321  Put replication filters with attached channel name into a vector.
322 
323  @param rpl_pfs_filter_vec the vector.
324  @param channel_name the name of the channel attached or NULL if
325  there is no channel attached.
326  */
327  void put_filters_into_vector(std::vector<Rpl_pfs_filter> &rpl_pfs_filter_vec,
328  const char *channel_name);
329 #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
330 
331  /**
332  Acquire the write lock.
333  */
335 
336  /**
337  Acquire the read lock.
338  */
340 
341  /**
342  Release the lock (whether it is a write or read lock).
343  */
345 
346  /**
347  Assert that some thread holds the write lock.
348  */
350 
351  /**
352  Assert that some thread holds the read lock.
353  */
355 
356  /**
357  Check if the relation between the per-channel filter and
358  the channel's Relay_log_info is established.
359 
360  @retval true if the relation is established
361  @retval false if the relation is not established
362  */
363  bool is_attached() { return attached; }
364 
365  /**
366  Set attached to true when the relation between the per-channel filter
367  and the channel's Relay_log_info is established.
368  */
369  void set_attached() { attached = true; }
370 
371  void reset();
372 
380 
381  private:
383  /*
384  State if the relation between the per-channel filter
385  and the channel's Relay_log_info is established.
386  */
387  bool attached;
388 
389  /*
390  While slave is not running after server startup, the replication filter
391  can be modified by CHANGE REPLICATION FILTER filter [, filter...]
392  [FOR CHANNEL <channel_name>] and CHANGE MASTER TO ... FOR CHANNEL,
393  and read by querying P_S.replication_applier_global_filters,
394  querying P_S.replication_applier_filters, and SHOW SLAVE STATUS
395  [FOR CHANNEL <channel_name>]. So the lock is introduced to protect
396  some member functions called by above commands. See below.
397 
398  The read lock should be held when calling the following member functions:
399  get_do_table(String* str); // SHOW SLAVE STATUS
400  get_ignore_table(String* str); // SHOW SLAVE STATUS
401  get_wild_do_table(String* str); // SHOW SLAVE STATUS
402  get_wild_ignore_table(String* str); // SHOW SLAVE STATUS
403  get_rewrite_db(const char* db, size_t *new_len); // SHOW SLAVE STATUS
404  get_rewrite_db(String *str); // SHOW SLAVE STATUS
405  get_do_db(); // SHOW SLAVE STATUS
406  get_do_db(String *str); // SHOW SLAVE STATUS
407  get_ignore_db(); // SHOW SLAVE STATUS
408  get_ignore_db(String *str); // SHOW SLAVE STATUS
409  put_filters_into_vector(...); // query P_S tables
410  get_filter_count(); // query P_S tables
411 
412  The write lock should be held when calling the following member functions:
413  set_do_db(List<Item> *list); // CHANGE REPLICATION FILTER
414  set_ignore_db(List<Item> *list); // CHANGE REPLICATION FILTER
415  set_do_table(List<Item> *list); // CHANGE REPLICATION FILTER
416  set_ignore_table(List<Item> *list); // CHANGE REPLICATION FILTER
417  set_wild_do_table(List<Item> *list); // CHANGE REPLICATION FILTER
418  set_wild_ignore_table(List<Item> *list); // CHANGE REPLICATION FILTER
419  set_db_rewrite(List<Item> *list); // CHANGE REPLICATION FILTER
420  copy_global_replication_filters(); // CHANGE MASTER TO ... FOR CHANNEL
421 
422  Please acquire a wrlock when modifying the replication filter (CHANGE
423  REPLICATION FILTER filter [, filter...] [FOR CHANNEL <channel_name>]
424  and CHANGE MASTER TO ... FOR CHANNEL).
425  Please acqurie a rdlock when reading the replication filter (
426  SELECT * FROM performance_schema.replication_applier_global_filters,
427  SELECT * FROM performance_schema.replication_applier_filters and
428  SHOW SLAVE STATUS [FOR CHANNEL <channel_name>]).
429 
430  Other member functions do not need the protection of the lock and we can
431  access thd->rli_slave->rpl_filter to filter log event without the
432  protection of the lock while slave is running, since the replication
433  filter is read/modified by a single thread during server startup and
434  there is no command can change it while slave is running.
435  */
437 
439  typedef collation_unordered_map<std::string,
442 
443  void init_table_rule_hash(Table_rule_hash **h, bool *h_inited);
444  void init_table_rule_array(Table_rule_array *, bool *a_inited);
445 
446  int add_table_rule_to_array(Table_rule_array *a, const char *table_spec);
447  int add_table_rule_to_hash(Table_rule_hash *h, const char *table_spec,
448  uint len);
449 
451 
453  /**
454  Builds a Table_rule_array from a hash of TABLE_RULE_ENT. Cannot be used for
455  any other hash, as it assumes that the hash entries are TABLE_RULE_ENT.
456 
457  @param table_array Pointer to the Table_rule_array to fill
458  @param h Pointer to the hash to read
459  @param inited True if the hash is initialized
460 
461  @retval 0 OK
462  @retval 1 Error
463  */
465  Table_rule_hash *h, bool inited);
466  /**
467  Builds a destination Table_rule_array from a source Table_rule_array
468  of TABLE_RULE_ENT.
469 
470  @param dest_array Pointer to the destination Table_rule_array to fill
471  @param source_array Pointer to the source Table_rule_array to read
472  @param inited True if the source Table_rule_array is initialized
473 
474  @retval 0 OK
475  @retval 1 Error
476  */
478  Table_rule_array *source_array,
479  bool inited);
481  bool inited);
482  TABLE_RULE_ENT *find_wild(Table_rule_array *a, const char *key, size_t len);
483 
485  Table_rule_hash **table_hash,
486  bool array_inited, bool *hash_inited);
487 
488  /*
489  Those 6 structures below are uninitialized memory unless the
490  corresponding *_inited variables are "true".
491  */
492  /* For quick search */
495 
498 
501 
508 
511 
513 };
514 
515 /**
516  The class is a Rpl_filter representing global replication filters,
517  with a vector that references all Rpl_pfs_filter objects used to
518  represent P_S.replication_applier_global_filters table.
519  There is one instance, rpl_global_filter, created globally for
520  replication global filter. The rpl_global_filter is created when
521  the server is started, destroyed when the server is stopped.
522 */
524  public:
527 
528 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
529  /**
530  Used only by replication performance schema indices to get the count
531  of global replication filters.
532 
533  @retval the count of global replication filters.
534  */
536  /**
537  Used only by replication performance schema indices to get the global
538  replication filter at the position 'pos' from the
539  rpl_pfs_filter_vec vector.
540 
541  @param pos the index in the rpl_pfs_filter_vec vector.
542 
543  @retval Rpl_pfs_filter A pointer to a Rpl_pfs_filter, or NULL if it
544  arrived the end of the rpl_pfs_filter_vec.
545  */
547  /**
548  This member function is called everytime the rules of the global
549  repliation filter are changed. Once that happens the PFS view of
550  global repliation filter is recreated.
551  */
552  void reset_pfs_view();
553 #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
554 
555  private:
556  /*
557  Store pointers of all Rpl_pfs_filter objects in
558  replication filter.
559  */
560  std::vector<Rpl_pfs_filter> rpl_pfs_filter_vec;
561  /* Prevent user from invoking default assignment function. */
563  /* Prevent user from invoking default copy constructor function. */
565 };
566 
567 /** Sql_cmd_change_repl_filter represents the command CHANGE REPLICATION
568  * FILTER.
569  */
571  public:
572  /** Constructor. */
574  : do_db_list(nullptr),
575  ignore_db_list(nullptr),
576  do_table_list(nullptr),
577  ignore_table_list(nullptr),
578  wild_do_table_list(nullptr),
579  wild_ignore_table_list(nullptr),
580  rewrite_db_pair_list(nullptr) {}
581 
583 
586  }
587  bool execute(THD *thd);
588 
589  void set_filter_value(List<Item> *item_list, options_mysqld filter_type);
590  bool change_rpl_filter(THD *thd);
591 
592  private:
600 };
601 
602 extern Rpl_filter *rpl_filter;
603 extern Rpl_filter *binlog_filter;
604 
605 #endif // RPL_FILTER_H
int add_wild_do_table(const char *table_spec)
Definition: rpl_filter.cc:585
List< Item > * do_table_list
Definition: rpl_filter.h:595
const char * get_channel_name()
Definition: rpl_filter.h:173
unsigned long long int ulonglong
Definition: my_inttypes.h:55
Representation of an SQL command.
Definition: sql_cmd.h:63
I_List< i_string > * get_do_db()
Definition: rpl_filter.cc:1201
int add_db_rewrite(const char *from_db, const char *to_db)
Definition: rpl_filter.cc:602
Rpl_filter.
Definition: rpl_filter.h:211
void get_wild_do_table(String *str)
Definition: rpl_filter.cc:1154
Our own string classes, used pervasively throughout the executor.
Rpl_filter_statistics * m_rpl_filter_statistics
Definition: rpl_filter.h:188
void rdlock()
Acquire the read lock.
Definition: rpl_gtid.h:453
int build_do_table_hash()
Definition: rpl_filter.cc:616
void add(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1)
Definition: suite_stubs.c:69
int set_do_table(List< Item > *list, enum_configured_by configured_by)
Definition: rpl_filter.cc:793
The class Rpl_pfs_filter is introduced to serve the performance_schema.replication_applier_filters ta...
Definition: rpl_filter.h:164
bool is_on()
Definition: rpl_filter.cc:565
void table_rule_ent_dynamic_array_to_str(String *s, Table_rule_array *a, bool inited)
Definition: rpl_filter.cc:1133
std::unordered_map, but with my_malloc and collation-aware comparison.
Definition: map_helpers.h:236
bool is_rewrite_empty()
Definition: rpl_filter.cc:567
TABLE_RULE_ENT * find_wild(Table_rule_array *a, const char *key, size_t len)
Definition: rpl_filter.cc:983
Rpl_filter_statistics ignore_table_statistics
Definition: rpl_filter.h:374
Some integer typedefs for easier portability.
std::unique_ptr< T, My_free_deleter > unique_ptr_my_free
std::unique_ptr, but with my_free as deleter.
Definition: map_helpers.h:126
int copy_global_replication_filters()
Copy global replication filters to its per-channel replication filters if there are no per-channel re...
Definition: rpl_filter.cc:188
int build_ignore_table_hash()
Definition: rpl_filter.cc:640
Rpl_global_filter()
Definition: rpl_filter.h:525
void wrlock()
Acquire the write lock.
Definition: rpl_filter.h:334
void free_string_list(I_List< i_string > *l)
Definition: rpl_filter.cc:1008
Definition: rpl_filter.h:83
const char * m_filter_name
Definition: rpl_filter.h:185
enum_sql_command
Definition: my_sqlcommand.h:45
void rdlock()
Acquire the read lock.
Definition: rpl_filter.h:339
void wrlock()
Acquire the write lock.
Definition: rpl_gtid.h:462
bool table_rules_on
Definition: rpl_filter.h:382
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 bee...
Definition: rpl_filter.cc:671
List< Item > * ignore_table_list
Definition: rpl_filter.h:596
Definition: rpl_filter.h:74
void free_string_array(Table_rule_array *a)
Definition: rpl_filter.cc:1003
class udf_list * list
void assert_some_wrlock() const
Assert that some thread holds the write lock.
Definition: rpl_gtid.h:526
std::vector< Rpl_pfs_filter > rpl_pfs_filter_vec
Definition: rpl_filter.h:560
Rpl_global_filter & operator=(const Rpl_global_filter &info)
Representation of an SQL command.
int set_wild_ignore_table(List< Item > *list, enum_configured_by configured_by)
Definition: rpl_filter.cc:865
bool attached
Definition: rpl_filter.h:387
Rpl_filter_statistics do_db_statistics
Definition: rpl_filter.h:377
Rpl_filter_statistics()
Definition: rpl_filter.cc:90
bool execute(THD *thd)
Execute this SQL statement.
Definition: rpl_filter.cc:1321
Using this class is fraught with peril, and you need to be very careful when doing so...
Definition: sql_string.h:161
const char * m_channel_name
Definition: rpl_filter.h:182
String m_filter_rule
Definition: rpl_filter.h:191
Checkable_rwlock * m_rpl_filter_lock
Definition: rpl_filter.h:436
bool is_empty()
Check if the replication filter is empty or not.
Definition: rpl_filter.cc:177
List< Item > * do_db_list
Definition: rpl_filter.h:593
bool db_ok_with_wild_table(const char *db)
Definition: rpl_filter.cc:536
int parse_filter_list(List< Item > *item_list, Add_filter func)
Definition: rpl_filter.cc:741
Rpl_filter()
Definition: rpl_filter.cc:119
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.
Definition: rpl_filter.cc:1102
Rpl_filter_statistics & operator=(Rpl_filter_statistics const &)
List< Item > * ignore_db_list
Definition: rpl_filter.h:594
I_List< i_string > ignore_db
Definition: rpl_filter.h:510
char * tbl_name
Definition: rpl_filter.h:76
void set_filter_value(List< Item > *item_list, options_mysqld filter_type)
Definition: rpl_filter.cc:1327
int add_wild_ignore_table(const char *table_spec)
Definition: rpl_filter.cc:593
~Sql_cmd_change_repl_filter()
Definition: rpl_filter.h:582
Rpl_filter_statistics * get_rewrite_db_statistics()
Definition: rpl_filter.h:312
void assert_some_rdlock()
Assert that some thread holds the read lock.
Definition: rpl_filter.h:354
bool do_table_array_inited
Definition: rpl_filter.h:504
Table_rule_hash * do_table_hash
Definition: rpl_filter.h:493
bool wild_do_table_inited
Definition: rpl_filter.h:506
char * pos
Definition: do_ctype.cc:76
int set_wild_do_table(List< Item > *list, enum_configured_by configured_by)
Definition: rpl_filter.cc:846
Table_rule_hash * ignore_table_hash
Definition: rpl_filter.h:494
void reset()
Definition: rpl_filter.cc:94
int set_db_rewrite(List< Item > *list, enum_configured_by configured_by)
Definition: rpl_filter.cc:884
Rpl_filter_statistics ignore_db_statistics
Definition: rpl_filter.h:378
bool wild_ignore_table_inited
Definition: rpl_filter.h:507
Rpl_filter * binlog_filter
Definition: mysqld.cc:1308
void unlock()
Release the lock (whether it is a write or read lock).
Definition: rpl_gtid.h:473
~Rpl_filter_statistics()
Definition: rpl_filter.cc:92
~Rpl_global_filter()
Definition: rpl_filter.h:526
List< Item > * wild_ignore_table_list
Definition: rpl_filter.h:598
Rpl_filter_statistics do_table_statistics
Definition: rpl_filter.h:373
void assert_some_wrlock()
Assert that some thread holds the write lock.
Definition: rpl_filter.h:349
Prealloced_array< TABLE_RULE_ENT *, 16 > Table_rule_array
Definition: rpl_filter.h:438
I_List< i_string > * get_ignore_db()
Definition: rpl_filter.cc:1217
Sql_cmd_change_repl_filter represents the command CHANGE REPLICATION FILTER.
Definition: rpl_filter.h:570
virtual ~Rpl_filter()
Definition: rpl_filter.cc:143
Definition: item.h:668
Rpl_filter & operator=(Rpl_filter const &)
unsigned int uint
Definition: uca-dump.cc:29
The class is a Rpl_filter representing global replication filters, with a vector that references all ...
Definition: rpl_filter.h:523
int set_ignore_db(List< Item > *list, enum_configured_by configured_by)
Definition: rpl_filter.cc:782
~Rpl_pfs_filter()
Definition: rpl_filter.cc:88
options_mysqld
only options that need special treatment in get_one_option() deserve to be listed below ...
Definition: options_mysqld.h:30
int add_table_rule_to_array(Table_rule_array *a, const char *table_spec)
Definition: rpl_filter.cc:721
uint get_filter_count()
Used only by replication performance schema indices to get the count of global replication filters...
Definition: rpl_filter.cc:1312
Sql_cmd_change_repl_filter()
Constructor.
Definition: rpl_filter.h:573
void table_rule_ent_hash_to_str(String *s, Table_rule_hash *h, bool inited)
Definition: rpl_filter.cc:1044
Rpl_pfs_filter * get_filter_at_pos(uint pos)
Used only by replication performance schema indices to get the global replication filter at the posit...
Definition: rpl_filter.cc:1302
void unlock()
Release the lock (whether it is a write or read lock).
Definition: rpl_filter.h:344
I_List< i_string > do_db
Definition: rpl_filter.h:509
ulonglong m_active_since
Definition: rpl_filter.h:133
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.
Definition: rpl_filter.cc:1235
Rpl_filter_statistics wild_ignore_table_statistics
Definition: rpl_filter.h:376
bool db_ok(const char *db, bool need_increase_counter=true)
Definition: rpl_filter.cc:454
bool ignore_table_hash_inited
Definition: rpl_filter.h:503
static bool inited
Definition: log_filter_dragnet.cc:120
Table_rule_array wild_ignore_table
Definition: rpl_filter.h:500
Table_rule_array wild_do_table
Definition: rpl_filter.h:499
bool is_attached()
Check if the relation between the per-channel filter and the channel&#39;s Relay_log_info is established...
Definition: rpl_filter.h:363
static const char * key
Definition: suite_stubs.c:14
Definition: my_sqlcommand.h:109
ulonglong get_active_since()
Definition: rpl_filter.h:117
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.
Definition: rpl_filter.cc:1070
Definition: rpl_filter.h:82
bool do_table_hash_inited
Definition: rpl_filter.h:502
int(Rpl_filter::* Add_filter)(char const *)
Definition: rpl_filter.h:264
List< Item > * wild_do_table_list
Definition: rpl_filter.h:597
void reset()
Definition: rpl_filter.cc:148
collation_unordered_map< std::string, unique_ptr_my_free< TABLE_RULE_ENT > > Table_rule_hash
Definition: rpl_filter.h:441
const char * get_rewrite_db(const char *db, size_t *new_len)
Definition: rpl_filter.cc:1182
int add_ignore_table_array(const char *table_spec)
Definition: rpl_filter.cc:577
std::atomic< uint64 > m_atomic_counter
Definition: rpl_filter.h:140
void assert_some_rdlock() const
Assert that some thread holds the read lock.
Definition: rpl_gtid.h:524
enum_configured_by get_configured_by()
Definition: rpl_filter.h:116
void set_attached()
Set attached to true when the relation between the per-channel filter and the channel&#39;s Relay_log_inf...
Definition: rpl_filter.h:369
Rpl_filter_statistics rewrite_db_statistics
Definition: rpl_filter.h:379
void set_all(enum_configured_by configured_by)
Definition: rpl_filter.cc:100
enum_configured_by
Enum values for CONFIGURED_BY column.
Definition: rpl_filter.h:81
I_List< i_string_pair > rewrite_db
Definition: rpl_filter.h:512
int set_ignore_table(List< Item > *list, enum_configured_by configured_by)
Definition: rpl_filter.cc:819
void init_table_rule_array(Table_rule_array *, bool *a_inited)
Definition: rpl_filter.cc:978
Rpl_filter_statistics * get_rpl_filter_statistics()
Definition: rpl_filter.h:176
int add_do_table_array(const char *table_spec)
Definition: rpl_filter.cc:569
Rpl_filter_statistics wild_do_table_statistics
Definition: rpl_filter.h:375
Rpl_pfs_filter & operator=(Rpl_pfs_filter const &)
ulonglong get_counter()
Definition: rpl_filter.h:118
Log info(cout, "NOTE")
const String & get_filter_rule()
Definition: rpl_filter.h:175
virtual enum_sql_command sql_command_code() const
Return the command code for this statement.
Definition: rpl_filter.h:584
void init_table_rule_hash(Table_rule_hash **h, bool *h_inited)
Definition: rpl_filter.cc:973
const char * get_filter_name()
Definition: rpl_filter.h:174
void get_do_table(String *str)
Definition: rpl_filter.cc:1146
Definition: table.h:2468
This has the functionality of mysql_rwlock_t, with two differences:
Definition: rpl_gtid.h:429
bool change_rpl_filter(THD *thd)
Execute a CHANGE REPLICATION FILTER statement to set filter rules.
Definition: rpl_filter.cc:1368
void free_string_pair_list(I_List< i_string_pair > *l)
Definition: rpl_filter.cc:1021
char * db
Definition: rpl_filter.h:75
void get_ignore_table(String *str)
Definition: rpl_filter.cc:1150
bool tables_ok(const char *db, TABLE_LIST *tables)
Definition: rpl_filter.cc:393
bool ignore_table_array_inited
Definition: rpl_filter.h:505
int add_string_pair_list(I_List< i_string_pair > *list, const char *key, const char *val)
Definition: rpl_filter.cc:934
int add_ignore_db(const char *db_spec)
Definition: rpl_filter.cc:967
uint key_len
Definition: rpl_filter.h:77
void get_wild_ignore_table(String *str)
Definition: rpl_filter.cc:1159
enum_configured_by m_configured_by
Definition: rpl_filter.h:130
Table_rule_array ignore_table_array
Definition: rpl_filter.h:497
int add_do_db(const char *db_spec)
Definition: rpl_filter.cc:961
void increase_counter()
Definition: rpl_filter.h:119
int add_string_list(I_List< i_string > *list, const char *spec)
Definition: rpl_filter.cc:915
void reset_pfs_view()
This member function is called everytime the rules of the global repliation filter are changed...
Definition: rpl_filter.cc:1292
int add_table_rule_to_hash(Table_rule_hash *h, const char *table_spec, uint len)
Added one table rule to hash.
Definition: rpl_filter.cc:699
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:778
List< Item > * rewrite_db_pair_list
Definition: rpl_filter.h:599
Table_rule_array do_table_array
Definition: rpl_filter.h:496
Rpl_filter * rpl_filter
Rpl_pfs_filter()
Definition: rpl_filter.cc:65
int set_do_db(List< Item > *list, enum_configured_by configured_by)
Definition: rpl_filter.cc:771
The class Rpl_filter_statistics encapsulates the following three statistics of replication filter: Th...
Definition: rpl_filter.h:103