MySQL  8.0.16
Source Code Documentation
rpl_filter.h
Go to the documentation of this file.
1 /* Copyright (c) 2000, 2018, 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);
249  int add_string_pair_list(I_List<i_string_pair> *list, char *key, char *val);
250  int add_do_table_array(const char *table_spec);
251  int add_ignore_table_array(const char *table_spec);
252 
253  int add_wild_do_table(const char *table_spec);
254  int add_wild_ignore_table(const char *table_spec);
255 
256  int set_do_db(List<Item> *list, enum_configured_by configured_by);
257  int set_ignore_db(List<Item> *list, enum_configured_by configured_by);
258  int set_do_table(List<Item> *list, enum_configured_by configured_by);
259  int set_ignore_table(List<Item> *list, enum_configured_by configured_by);
262  int set_db_rewrite(List<Item> *list, enum_configured_by configured_by);
263  typedef int (Rpl_filter::*Add_filter)(char const *);
264  int parse_filter_list(List<Item> *item_list, Add_filter func);
265  /**
266  Execute the specified func with elements of the list as input.
267 
268  @param list A list with I_List<i_string> type
269  @param add A function with Add_filter type
270 
271  @retval 0 OK
272  @retval 1 Error
273  */
275  int add_do_db(const char *db_spec);
276  int add_ignore_db(const char *db_spec);
277 
278  int add_db_rewrite(const char *from_db, const char *to_db);
279 
280  /* Getters - to get information about current rules */
281 
282  void get_do_table(String *str);
283  void get_ignore_table(String *str);
284 
285  void get_wild_do_table(String *str);
286  void get_wild_ignore_table(String *str);
287 
288  const char *get_rewrite_db(const char *db, size_t *new_len);
289  void get_rewrite_db(String *str);
290 
292  /*
293  Get do_db rule.
294 
295  @param[out] str the db_db rule.
296  */
297  void get_do_db(String *str);
298 
300  /*
301  Get ignore_db rule.
302 
303  @param[out] str the ignore_db rule.
304  */
305  void get_ignore_db(String *str);
306  /*
307  Get rewrite_db_statistics.
308 
309  @retval A pointer to a rewrite_db_statistics object.
310  */
312  return &rewrite_db_statistics;
313  }
314 
317 
318 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
319  /**
320  Put replication filters with attached channel name into a vector.
321 
322  @param rpl_pfs_filter_vec the vector.
323  @param channel_name the name of the channel attached or NULL if
324  there is no channel attached.
325  */
326  void put_filters_into_vector(std::vector<Rpl_pfs_filter> &rpl_pfs_filter_vec,
327  const char *channel_name);
328 #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
329 
330  /**
331  Acquire the write lock.
332  */
334 
335  /**
336  Acquire the read lock.
337  */
339 
340  /**
341  Release the lock (whether it is a write or read lock).
342  */
344 
345  /**
346  Assert that some thread holds the write lock.
347  */
349 
350  /**
351  Assert that some thread holds the read lock.
352  */
354 
355  /**
356  Check if the relation between the per-channel filter and
357  the channel's Relay_log_info is established.
358 
359  @retval true if the relation is established
360  @retval false if the relation is not established
361  */
362  bool is_attached() { return attached; }
363 
364  /**
365  Set attached to true when the relation between the per-channel filter
366  and the channel's Relay_log_info is established.
367  */
368  void set_attached() { attached = true; }
369 
370  void reset();
371 
379 
380  private:
382  /*
383  State if the relation between the per-channel filter
384  and the channel's Relay_log_info is established.
385  */
386  bool attached;
387 
388  /*
389  While slave is not running after server startup, the replication filter
390  can be modified by CHANGE REPLICATION FILTER filter [, filter...]
391  [FOR CHANNEL <channel_name>] and CHANGE MASTER TO ... FOR CHANNEL,
392  and read by querying P_S.replication_applier_global_filters,
393  querying P_S.replication_applier_filters, and SHOW SLAVE STATUS
394  [FOR CHANNEL <channel_name>]. So the lock is introduced to protect
395  some member functions called by above commands. See below.
396 
397  The read lock should be held when calling the following member functions:
398  get_do_table(String* str); // SHOW SLAVE STATUS
399  get_ignore_table(String* str); // SHOW SLAVE STATUS
400  get_wild_do_table(String* str); // SHOW SLAVE STATUS
401  get_wild_ignore_table(String* str); // SHOW SLAVE STATUS
402  get_rewrite_db(const char* db, size_t *new_len); // SHOW SLAVE STATUS
403  get_rewrite_db(String *str); // SHOW SLAVE STATUS
404  get_do_db(); // SHOW SLAVE STATUS
405  get_do_db(String *str); // SHOW SLAVE STATUS
406  get_ignore_db(); // SHOW SLAVE STATUS
407  get_ignore_db(String *str); // SHOW SLAVE STATUS
408  put_filters_into_vector(...); // query P_S tables
409  get_filter_count(); // query P_S tables
410 
411  The write lock should be held when calling the following member functions:
412  set_do_db(List<Item> *list); // CHANGE REPLICATION FILTER
413  set_ignore_db(List<Item> *list); // CHANGE REPLICATION FILTER
414  set_do_table(List<Item> *list); // CHANGE REPLICATION FILTER
415  set_ignore_table(List<Item> *list); // CHANGE REPLICATION FILTER
416  set_wild_do_table(List<Item> *list); // CHANGE REPLICATION FILTER
417  set_wild_ignore_table(List<Item> *list); // CHANGE REPLICATION FILTER
418  set_db_rewrite(List<Item> *list); // CHANGE REPLICATION FILTER
419  copy_global_replication_filters(); // CHANGE MASTER TO ... FOR CHANNEL
420 
421  Please acquire a wrlock when modifying the replication filter (CHANGE
422  REPLICATION FILTER filter [, filter...] [FOR CHANNEL <channel_name>]
423  and CHANGE MASTER TO ... FOR CHANNEL).
424  Please acqurie a rdlock when reading the replication filter (
425  SELECT * FROM performance_schema.replication_applier_global_filters,
426  SELECT * FROM performance_schema.replication_applier_filters and
427  SHOW SLAVE STATUS [FOR CHANNEL <channel_name>]).
428 
429  Other member functions do not need the protection of the lock and we can
430  access thd->rli_slave->rpl_filter to filter log event without the
431  protection of the lock while slave is running, since the replication
432  filter is read/modified by a single thread during server startup and
433  there is no command can change it while slave is running.
434  */
436 
438  typedef collation_unordered_map<std::string,
441 
442  void init_table_rule_hash(Table_rule_hash **h, bool *h_inited);
443  void init_table_rule_array(Table_rule_array *, bool *a_inited);
444 
445  int add_table_rule_to_array(Table_rule_array *a, const char *table_spec);
446  int add_table_rule_to_hash(Table_rule_hash *h, const char *table_spec,
447  uint len);
448 
450 
452  /**
453  Builds a Table_rule_array from a hash of TABLE_RULE_ENT. Cannot be used for
454  any other hash, as it assumes that the hash entries are TABLE_RULE_ENT.
455 
456  @param table_array Pointer to the Table_rule_array to fill
457  @param h Pointer to the hash to read
458  @param inited True if the hash is initialized
459 
460  @retval 0 OK
461  @retval 1 Error
462  */
464  Table_rule_hash *h, bool inited);
465  /**
466  Builds a destination Table_rule_array from a source Table_rule_array
467  of TABLE_RULE_ENT.
468 
469  @param dest_array Pointer to the destination Table_rule_array to fill
470  @param source_array Pointer to the source Table_rule_array to read
471  @param inited True if the source Table_rule_array is initialized
472 
473  @retval 0 OK
474  @retval 1 Error
475  */
477  Table_rule_array *source_array,
478  bool inited);
480  bool inited);
481  TABLE_RULE_ENT *find_wild(Table_rule_array *a, const char *key, size_t len);
482 
484  Table_rule_hash **table_hash,
485  bool array_inited, bool *hash_inited);
486 
487  /*
488  Those 6 structures below are uninitialized memory unless the
489  corresponding *_inited variables are "true".
490  */
491  /* For quick search */
494 
497 
500 
507 
510 
512 };
513 
514 /**
515  The class is a Rpl_filter representing global replication filters,
516  with a vector that references all Rpl_pfs_filter objects used to
517  represent P_S.replication_applier_global_filters table.
518  There is one instance, rpl_global_filter, created globally for
519  replication global filter. The rpl_global_filter is created when
520  the server is started, destroyed when the server is stopped.
521 */
523  public:
526 
527 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
528  /**
529  Used only by replication performance schema indices to get the count
530  of global replication filters.
531 
532  @retval the count of global replication filters.
533  */
535  /**
536  Used only by replication performance schema indices to get the global
537  replication filter at the position 'pos' from the
538  rpl_pfs_filter_vec vector.
539 
540  @param pos the index in the rpl_pfs_filter_vec vector.
541 
542  @retval Rpl_pfs_filter A pointer to a Rpl_pfs_filter, or NULL if it
543  arrived the end of the rpl_pfs_filter_vec.
544  */
546  /**
547  This member function is called everytime the rules of the global
548  repliation filter are changed. Once that happens the PFS view of
549  global repliation filter is recreated.
550  */
551  void reset_pfs_view();
552 #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
553 
554  private:
555  /*
556  Store pointers of all Rpl_pfs_filter objects in
557  replication filter.
558  */
559  std::vector<Rpl_pfs_filter> rpl_pfs_filter_vec;
560  /* Prevent user from invoking default assignment function. */
562  /* Prevent user from invoking default copy constructor function. */
564 };
565 
566 /** Sql_cmd_change_repl_filter represents the command CHANGE REPLICATION
567  * FILTER.
568  */
570  public:
571  /** Constructor. */
573  : do_db_list(NULL),
580 
582 
585  }
586  bool execute(THD *thd);
587 
588  void set_filter_value(List<Item> *item_list, options_mysqld filter_type);
589  bool change_rpl_filter(THD *thd);
590 
591  private:
599 };
600 
601 extern Rpl_filter *rpl_filter;
602 extern Rpl_filter *binlog_filter;
603 
604 #endif // RPL_FILTER_H
int add_wild_do_table(const char *table_spec)
Definition: rpl_filter.cc:586
List< Item > * do_table_list
Definition: rpl_filter.h:594
const char * get_channel_name()
Definition: rpl_filter.h:173
unsigned long long int ulonglong
Definition: my_inttypes.h:69
Representation of an SQL command.
Definition: sql_cmd.h:62
I_List< i_string > * get_do_db()
Definition: rpl_filter.cc:1203
int add_db_rewrite(const char *from_db, const char *to_db)
Definition: rpl_filter.cc:603
Rpl_filter.
Definition: rpl_filter.h:211
void get_wild_do_table(String *str)
Definition: rpl_filter.cc:1156
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
t pos
Definition: dbug_analyze.cc:148
int build_do_table_hash()
Definition: rpl_filter.cc:617
int set_do_table(List< Item > *list, enum_configured_by configured_by)
Definition: rpl_filter.cc:795
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:566
void table_rule_ent_dynamic_array_to_str(String *s, Table_rule_array *a, bool inited)
Definition: rpl_filter.cc:1135
std::unordered_map, but with my_malloc and collation-aware comparison.
Definition: map_helpers.h:236
bool is_rewrite_empty()
Definition: rpl_filter.cc:568
TABLE_RULE_ENT * find_wild(Table_rule_array *a, const char *key, size_t len)
Definition: rpl_filter.cc:985
Rpl_filter_statistics ignore_table_statistics
Definition: rpl_filter.h:373
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:641
Rpl_global_filter()
Definition: rpl_filter.h:524
void wrlock()
Acquire the write lock.
Definition: rpl_filter.h:333
void free_string_list(I_List< i_string > *l)
Definition: rpl_filter.cc:1010
Definition: rpl_filter.h:83
const char * m_filter_name
Definition: rpl_filter.h:185
unsigned int add(m_name) char *m_name
enum_sql_command
Definition: my_sqlcommand.h:45
void rdlock()
Acquire the read lock.
Definition: rpl_filter.h:338
void wrlock()
Acquire the write lock.
Definition: rpl_gtid.h:462
Sergei Dialog Client Authentication NULL
Definition: dialog.cc:352
bool table_rules_on
Definition: rpl_filter.h:381
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:672
List< Item > * ignore_table_list
Definition: rpl_filter.h:595
Definition: rpl_filter.h:74
void free_string_array(Table_rule_array *a)
Definition: rpl_filter.cc:1005
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:559
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:867
bool attached
Definition: rpl_filter.h:386
Rpl_filter_statistics do_db_statistics
Definition: rpl_filter.h:376
Rpl_filter_statistics()
Definition: rpl_filter.cc:90
bool execute(THD *thd)
Execute this SQL statement.
Definition: rpl_filter.cc:1327
Using this class is fraught with peril, and you need to be very careful when doing so...
Definition: sql_string.h:159
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:435
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:592
bool db_ok_with_wild_table(const char *db)
Definition: rpl_filter.cc:537
int parse_filter_list(List< Item > *item_list, Add_filter func)
Definition: rpl_filter.cc:743
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:1104
Rpl_filter_statistics & operator=(Rpl_filter_statistics const &)
List< Item > * ignore_db_list
Definition: rpl_filter.h:593
I_List< i_string > ignore_db
Definition: rpl_filter.h:509
char * tbl_name
Definition: rpl_filter.h:76
void set_filter_value(List< Item > *item_list, options_mysqld filter_type)
Definition: rpl_filter.cc:1333
int add_wild_ignore_table(const char *table_spec)
Definition: rpl_filter.cc:594
~Sql_cmd_change_repl_filter()
Definition: rpl_filter.h:581
Rpl_filter_statistics * get_rewrite_db_statistics()
Definition: rpl_filter.h:311
void assert_some_rdlock()
Assert that some thread holds the read lock.
Definition: rpl_filter.h:353
bool do_table_array_inited
Definition: rpl_filter.h:503
Table_rule_hash * do_table_hash
Definition: rpl_filter.h:492
bool wild_do_table_inited
Definition: rpl_filter.h:505
int set_wild_do_table(List< Item > *list, enum_configured_by configured_by)
Definition: rpl_filter.cc:848
Table_rule_hash * ignore_table_hash
Definition: rpl_filter.h:493
void reset()
Definition: rpl_filter.cc:94
int set_db_rewrite(List< Item > *list, enum_configured_by configured_by)
Definition: rpl_filter.cc:886
Rpl_filter_statistics ignore_db_statistics
Definition: rpl_filter.h:377
bool wild_ignore_table_inited
Definition: rpl_filter.h:506
Rpl_filter * binlog_filter
Definition: mysqld.cc:1266
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:525
List< Item > * wild_ignore_table_list
Definition: rpl_filter.h:597
Rpl_filter_statistics do_table_statistics
Definition: rpl_filter.h:372
void assert_some_wrlock()
Assert that some thread holds the write lock.
Definition: rpl_filter.h:348
Prealloced_array< TABLE_RULE_ENT *, 16 > Table_rule_array
Definition: rpl_filter.h:437
I_List< i_string > * get_ignore_db()
Definition: rpl_filter.cc:1219
Sql_cmd_change_repl_filter represents the command CHANGE REPLICATION FILTER.
Definition: rpl_filter.h:569
virtual ~Rpl_filter()
Definition: rpl_filter.cc:143
unsigned int len
Definition: dbug_analyze.cc:216
Definition: item.h:666
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:522
int set_ignore_db(List< Item > *list, enum_configured_by configured_by)
Definition: rpl_filter.cc:784
~Rpl_pfs_filter()
Definition: rpl_filter.cc:88
int add_string_pair_list(I_List< i_string_pair > *list, char *key, char *val)
Definition: rpl_filter.cc:936
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:723
uint get_filter_count()
Used only by replication performance schema indices to get the count of global replication filters...
Definition: rpl_filter.cc:1318
Sql_cmd_change_repl_filter()
Constructor.
Definition: rpl_filter.h:572
void table_rule_ent_hash_to_str(String *s, Table_rule_hash *h, bool inited)
Definition: rpl_filter.cc:1046
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:1308
void unlock()
Release the lock (whether it is a write or read lock).
Definition: rpl_filter.h:343
I_List< i_string > do_db
Definition: rpl_filter.h:508
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:1237
Rpl_filter_statistics wild_ignore_table_statistics
Definition: rpl_filter.h:375
bool db_ok(const char *db, bool need_increase_counter=true)
Definition: rpl_filter.cc:455
bool ignore_table_hash_inited
Definition: rpl_filter.h:502
static bool inited
Definition: log_filter_dragnet.cc:120
Table_rule_array wild_ignore_table
Definition: rpl_filter.h:499
Table_rule_array wild_do_table
Definition: rpl_filter.h:498
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:362
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:1072
Definition: rpl_filter.h:82
bool do_table_hash_inited
Definition: rpl_filter.h:501
int(Rpl_filter::* Add_filter)(char const *)
Definition: rpl_filter.h:263
List< Item > * wild_do_table_list
Definition: rpl_filter.h:596
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:440
const char * get_rewrite_db(const char *db, size_t *new_len)
Definition: rpl_filter.cc:1184
int add_ignore_table_array(const char *table_spec)
Definition: rpl_filter.cc:578
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:368
Rpl_filter_statistics rewrite_db_statistics
Definition: rpl_filter.h:378
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:511
int set_ignore_table(List< Item > *list, enum_configured_by configured_by)
Definition: rpl_filter.cc:821
void init_table_rule_array(Table_rule_array *, bool *a_inited)
Definition: rpl_filter.cc:980
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:570
Rpl_filter_statistics wild_do_table_statistics
Definition: rpl_filter.h:374
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:583
void init_table_rule_hash(Table_rule_hash **h, bool *h_inited)
Definition: rpl_filter.cc:975
const char * get_filter_name()
Definition: rpl_filter.h:174
void get_do_table(String *str)
Definition: rpl_filter.cc:1148
Definition: table.h:2439
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:1375
void free_string_pair_list(I_List< i_string_pair > *l)
Definition: rpl_filter.cc:1023
char * db
Definition: rpl_filter.h:75
void get_ignore_table(String *str)
Definition: rpl_filter.cc:1152
bool tables_ok(const char *db, TABLE_LIST *tables)
Definition: rpl_filter.cc:393
bool ignore_table_array_inited
Definition: rpl_filter.h:504
int add_ignore_db(const char *db_spec)
Definition: rpl_filter.cc:969
uint key_len
Definition: rpl_filter.h:77
void get_wild_ignore_table(String *str)
Definition: rpl_filter.cc:1161
enum_configured_by m_configured_by
Definition: rpl_filter.h:130
Table_rule_array ignore_table_array
Definition: rpl_filter.h:496
int add_do_db(const char *db_spec)
Definition: rpl_filter.cc:963
void increase_counter()
Definition: rpl_filter.h:119
int add_string_list(I_List< i_string > *list, const char *spec)
Definition: rpl_filter.cc:917
void reset_pfs_view()
This member function is called everytime the rules of the global repliation filter are changed...
Definition: rpl_filter.cc:1296
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:701
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:776
List< Item > * rewrite_db_pair_list
Definition: rpl_filter.h:598
Table_rule_array do_table_array
Definition: rpl_filter.h:495
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:773
The class Rpl_filter_statistics encapsulates the following three statistics of replication filter: Th...
Definition: rpl_filter.h:103