MySQL  8.0.27
Source Code Documentation
rpl_msr.h
Go to the documentation of this file.
1 /* Copyright (c) 2014, 2021, Oracle and/or its affiliates.
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_MSR_H
24 #define RPL_MSR_H
25 
26 #include "my_config.h"
27 
28 #include <stddef.h>
29 #include <sys/types.h>
30 #include <map>
31 #include <string>
32 #include <utility>
33 #include <vector>
34 
35 #include "my_dbug.h"
36 #include "my_psi_config.h"
37 #include "sql/mysqld.h" // key_rwlock_channel_map_lock
38 #include "sql/rpl_channel_service_interface.h" // enum_channel_type
39 #include "sql/rpl_filter.h"
40 #include "sql/rpl_gtid.h"
41 #include "sql/rpl_io_monitor.h"
42 #include "sql/rpl_mi.h"
43 
44 class Master_info;
45 
46 /**
47  Maps a channel name to it's Master_info.
48 */
49 
50 // Maps a master info object to a channel name
51 typedef std::map<std::string, Master_info *> mi_map;
52 // Maps a channel type to a map of channels of that type.
53 typedef std::map<int, mi_map> replication_channel_map;
54 // Maps a replication filter to a channel name.
55 typedef std::map<std::string, Rpl_filter *> filter_map;
56 
57 /**
58  Class to store all the Master_info objects of a slave
59  to access them in the replication code base or performance
60  schema replication tables.
61 
62  In a Multisourced replication setup, a slave connects
63  to several masters (also called as sources). This class
64  stores the Master_infos where each Master_info belongs
65  to a slave.
66 
67  The important objects for a slave are the following:
68  i) Master_info and Relay_log_info (replica_parallel_workers == 0)
69  ii) Master_info, Relay_log_info and Slave_worker(replica_parallel_workers >0 )
70 
71  Master_info is always assosiated with a Relay_log_info per channel.
72  So, it is enough to store Master_infos and call the corresponding
73  Relay_log_info by mi->rli;
74 
75  This class is not yet thread safe. Any part of replication code that
76  calls this class member function should always lock the channel_map.
77 
78  Only a single global object for a server instance should be created.
79 
80  The two important data structures in this class are
81  i) C++ std map to store the Master_info pointers with channel name as a key.
82  These are the base channel maps.
83  @todo Convert to boost after it's introduction.
84 
85  ii) C++ std map to store the channel maps with a channel type as its key.
86  This map stores slave channel maps, group replication channels or others
87  iii) An array of Master_info pointers to access from performance schema
88  tables. This array is specifically implemented in a way to make
89  a) pfs indices simple i.e a simple integer counter
90  b) To avoid recalibration of data structure if master info is deleted.
91  * Consider the following high level implementation of a pfs table
92  to make a row.
93  @code
94  highlevel_pfs_funciton()
95  {
96  while(replication_table_xxxx.rnd_next())
97  {
98  do stuff;
99  }
100  }
101  @endcode
102  However, we lock channel_map lock for every rnd_next(); There is a gap
103  where an addition/deletion of a channel would rearrange the map
104  making the integer indices of the pfs table point to a wrong value.
105  Either missing a row or duplicating a row.
106 
107  We solve this problem, by using an array exclusively to use in
108  replciation pfs tables, by marking a master_info defeated as 0
109  (i.e NULL). A new master info is added to this array at the
110  first NULL always.
111 */
113  private:
114  /* Maximum number of channels per slave */
115  static const unsigned int MAX_CHANNELS = 256;
116 
117  /* A Map that maps, a channel name to a Master_info grouped by channel type */
119 
120  /* Number of master_infos at the moment*/
122 
123  /**
124  Default_channel for this instance, currently is predefined
125  and cannot be modified.
126  */
127  static const char *default_channel;
129  static const char *group_replication_channel_names[];
130 
131  /**
132  This lock was designed to protect the channel_map from adding or removing
133  master_info objects from the map (adding or removing replication channels).
134  In fact it also acts like the LOCK_active_mi of MySQL 5.6, preventing two
135  replication administrative commands to run in parallel.
136  */
138 
139 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
140 
141  /* Array for replication performance schema related tables */
143 
144 #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
145 
146  /*
147  A empty mi_map to allow Multisource_info::end() to return a
148  valid constant value.
149  */
151 
152  public:
153  /* Constructor for this class.*/
155  /*
156  This class should be a singleton.
157  The assert below is to prevent it to be instantiated more than once.
158  */
159 #ifndef NDEBUG
160  static int instance_count = 0;
161  instance_count++;
162  assert(instance_count == 1);
163 #endif
164  current_mi_count = 0;
165  default_channel_mi = nullptr;
166 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
167  init_rpl_pfs_mi();
168 #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
169 
171 #ifdef HAVE_PSI_INTERFACE
173 #endif
174  );
175  }
176 
177  /* Destructor for this class.*/
179 
180  /**
181  Adds the Master_info object to both replication_channel_map and rpl_pfs_mi
182 
183  @param[in] channel_name channel name
184  @param[in] mi pointer to master info corresponding
185  to this channel
186  @retval false succesfully added
187  @retval true couldn't add channel
188  */
189  bool add_mi(const char *channel_name, Master_info *mi);
190 
191  /**
192  Find the master_info object corresponding to a channel explicitly
193  from replication channel_map;
194  Return if it exists, otherwise return 0
195 
196  @param[in] channel_name channel name for the master info object.
197 
198  @returns pointer to the master info object if exists
199  in the map. Otherwise, NULL;
200  */
201  Master_info *get_mi(const char *channel_name);
202 
203  /**
204  Return the master_info object corresponding to the default channel.
205  @retval pointer to the master info object if exists.
206  Otherwise, NULL;
207  */
210  return default_channel_mi;
211  }
212 
213  /**
214  Remove the entry corresponding to the channel, from the
215  replication_channel_map and sets index in the multisource_mi to 0;
216  And also delete the {mi, rli} pair corresponding to this channel
217 
218  @param[in] channel_name Name of the channel for a Master_info
219  object which must exist.
220  */
221  void delete_mi(const char *channel_name);
222 
223  /**
224  Get the default channel for this multisourced_slave;
225  */
226  inline const char *get_default_channel() { return default_channel; }
227 
228  /**
229  Get the number of instances of Master_info in the map.
230 
231  @param all If it should count all channels.
232  If false, only slave channels are counted.
233 
234  @return The number of channels or 0 if empty.
235  */
236  inline size_t get_num_instances(bool all = false) {
237  DBUG_TRACE;
238 
240 
241  replication_channel_map::iterator map_it;
242 
243  if (all) {
244  size_t count = 0;
245 
246  for (map_it = rep_channel_map.begin(); map_it != rep_channel_map.end();
247  map_it++) {
248  count += map_it->second.size();
249  }
250  return count;
251  } else // Return only the slave channels
252  {
254 
255  if (map_it == rep_channel_map.end())
256  return 0;
257  else
258  return map_it->second.size();
259  }
260  }
261 
262  /**
263  Get the number of running channels which have asynchronous replication
264  failover feature, i.e. CHANGE MASTER TO option
265  SOURCE_CONNECTION_AUTO_FAILOVER, enabled.
266 
267  @return The number of channels.
268  */
270  DBUG_TRACE;
272  size_t count = 0;
273 
274  replication_channel_map::iterator map_it =
276 
277  for (mi_map::iterator it = map_it->second.begin();
278  it != map_it->second.end(); it++) {
279  Master_info *mi = it->second;
280  if (Master_info::is_configured(mi) &&
283  if (mi->slave_running || mi->is_error()) {
284  count++;
285  }
287  }
288  }
289 
290 #ifndef NDEBUG
291  if (Source_IO_monitor::get_instance()->is_monitoring_process_running()) {
292  assert(count > 0);
293  }
294 #endif
295 
296  return count;
297  }
298 
299  /**
300  Get max channels allowed for this map.
301  */
302  inline uint get_max_channels() { return MAX_CHANNELS; }
303 
304  /**
305  Returns true if the current number of channels in this slave
306  is less than the MAX_CHANNLES
307  */
308  inline bool is_valid_channel_count() {
311  DBUG_EXECUTE_IF("max_replication_channels_exceeded", is_valid = false;);
312  return (is_valid);
313  }
314 
315  /**
316  Returns if a channel name is one of the reserved group replication names
317 
318  @param channel the channel name to test
319  @param is_applier compare only with applier name
320 
321  @retval true the name is a reserved name
322  @retval false non reserved name
323  */
325  bool is_applier = false);
326 
327  /**
328  Forward iterators to initiate traversing of a map.
329 
330  @todo: Not to expose iterators. But instead to return
331  only Master_infos or create generators when
332  c++11 is introduced.
333  */
334  mi_map::iterator begin(
336  replication_channel_map::iterator map_it;
337  map_it = rep_channel_map.find(channel_type);
338 
339  if (map_it != rep_channel_map.end()) {
340  return map_it->second.begin();
341  }
342 
343  return end(channel_type);
344  }
345 
346  mi_map::iterator end(
348  replication_channel_map::iterator map_it;
349  map_it = rep_channel_map.find(channel_type);
350 
351  if (map_it != rep_channel_map.end()) {
352  return map_it->second.end();
353  }
354 
355  return empty_mi_map.end();
356  }
357 
358  private:
359 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
360 
361  /* Initialize the rpl_pfs_mi array to NULLs */
362  inline void init_rpl_pfs_mi() {
363  for (uint i = 0; i < MAX_CHANNELS; i++) rpl_pfs_mi[i] = nullptr;
364  }
365 
366  /**
367  Add a master info pointer to the rpl_pfs_mi array at the first
368  NULL;
369 
370  @param[in] mi master info object to be added.
371 
372  @return false if success.Else true.
373  */
375 
376  /**
377  Get the index of the master info corresponding to channel name
378  from the rpl_pfs_mi array.
379  @param[in] channel_name Channel name to get the index from
380 
381  @return index of mi for the channel_name. Else -1;
382  */
383  int get_index_from_rpl_pfs_mi(const char *channel_name);
384 
385  public:
386  /**
387  Used only by replication performance schema indices to get the master_info
388  at the position 'pos' from the rpl_pfs_mi array.
389 
390  @param[in] pos the index in the rpl_pfs_mi array
391 
392  @retval pointer to the master info object at pos 'pos';
393  */
395 #endif /*WITH_PERFSCHEMA_STORAGE_ENGINE */
396 
397  /**
398  Acquire the read lock.
399  */
400  inline void rdlock() { m_channel_map_lock->rdlock(); }
401 
402  /**
403  Try to acquire a read lock, return 0 if the read lock is held,
404  otherwise an error will be returned.
405 
406  @return 0 in case of success, or 1 otherwise.
407  */
408  inline int tryrdlock() { return m_channel_map_lock->tryrdlock(); }
409 
410  /**
411  Acquire the write lock.
412  */
413  inline void wrlock() { m_channel_map_lock->wrlock(); }
414 
415  /**
416  Try to acquire a write lock, return 0 if the write lock is held,
417  otherwise an error will be returned.
418 
419  @return 0 in case of success, or 1 otherwise.
420  */
421  inline int trywrlock() { return m_channel_map_lock->trywrlock(); }
422 
423  /**
424  Release the lock (whether it is a write or read lock).
425  */
426  inline void unlock() { m_channel_map_lock->unlock(); }
427 
428  /**
429  Assert that some thread holds either the read or the write lock.
430  */
431  inline void assert_some_lock() const {
433  }
434 
435  /**
436  Assert that some thread holds the write lock.
437  */
438  inline void assert_some_wrlock() const {
440  }
441 };
442 
443 /**
444  The class is a container for all the per-channel filters, both a map of
445  Rpl_filter objects and a list of Rpl_pfs_filter objects.
446  It maintains a filter map which maps a replication filter to a channel
447  name. Which is needed, because replication channels are not created and
448  channel_map is not filled in when these global and per-channel replication
449  filters are evaluated with current code frame.
450  In theory, after instantiating all channels from the repository and throwing
451  all the warnings about the filters configured for non-existent channels, we
452  can forget about its global object rpl_channel_filters and rely only on the
453  global and per channel Rpl_filter objects. But to avoid holding the
454  channel_map.rdlock() when quering P_S.replication_applier_filters table,
455  we keep the rpl_channel_filters. So that we just need to hold the small
456  rpl_channel_filters.rdlock() when quering P_S.replication_applier_filters
457  table. Many operations (RESET SLAVE [FOR CHANNEL], START SLAVE, INIT SLAVE,
458  END SLAVE, CHANGE MASTER TO, FLUSH RELAY LOGS, START CHANNEL, PURGE CHANNEL,
459  and so on) hold the channel_map.wrlock().
460 
461  There is one instance, rpl_channel_filters, created globally for Multisource
462  channel filters. The rpl_channel_filters is created when the server is
463  started, destroyed when the server is stopped.
464 */
466  private:
467  /* Store all replication filters with channel names. */
469  /* Store all Rpl_pfs_filter objects in the channel_to_filter. */
470  std::vector<Rpl_pfs_filter> rpl_pfs_filter_vec;
471  /*
472  This lock was designed to protect the channel_to_filter from reading,
473  adding, or removing its objects from the map. It is used to preventing
474  the following commands to run in parallel:
475  RESET SLAVE ALL [FOR CHANNEL '<channel_name>']
476  CHANGE MASTER TO ... FOR CHANNEL
477  SELECT FROM performance_schema.replication_applier_filters
478 
479  Please acquire a wrlock when modifying the map structure (RESET SLAVE ALL
480  [FOR CHANNEL '<channel_name>'], CHANGE MASTER TO ... FOR CHANNEL).
481  Please acqurie a rdlock when querying existing filter(s) (SELECT FROM
482  performance_schema.replication_applier_filters).
483 
484  Note: To modify the object from the map, please see the protection of
485  m_rpl_filter_lock in Rpl_filter.
486  */
488 
489  public:
490  /**
491  Create a new replication filter and add it into a filter map.
492 
493  @param channel_name A name of a channel.
494 
495  @retval Rpl_filter A pointer to a replication filter, or NULL
496  if we failed to add it into fiter_map.
497  */
498  Rpl_filter *create_filter(const char *channel_name);
499  /**
500  Delete the replication filter from the filter map.
501 
502  @param rpl_filter A pointer to point to a replication filter.
503  */
505  /**
506  Discard all replication filters if they are not attached to channels.
507  */
509  /**
510  discard filters on group replication channels.
511  */
513  /**
514  Get a replication filter of a channel.
515 
516  @param channel_name A name of a channel.
517 
518  @retval Rpl_filter A pointer to a replication filter, or NULL
519  if we failed to add a replication filter
520  into fiter_map when creating it.
521  */
522  Rpl_filter *get_channel_filter(const char *channel_name);
523 
524 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
525 
526  /**
527  This member function is called everytime a filter is created or deleted,
528  or its filter rules are changed. Once that happens the PFS view is
529  recreated.
530  */
531  void reset_pfs_view();
532 
533  /**
534  Used only by replication performance schema indices to get the replication
535  filter at the position 'pos' from the rpl_pfs_filter_vec vector.
536 
537  @param pos the index in the rpl_pfs_filter_vec vector.
538 
539  @retval Rpl_filter A pointer to a Rpl_pfs_filter, or NULL if it
540  arrived the end of the rpl_pfs_filter_vec.
541  */
543  /**
544  Used only by replication performance schema indices to get the count
545  of replication filters from the rpl_pfs_filter_vec vector.
546 
547  @retval the count of the replication filters.
548  */
550 #endif /*WITH_PERFSCHEMA_STORAGE_ENGINE */
551 
552  /**
553  Traverse the filter map, build do_table and ignore_table
554  rules to hashes for every filter.
555 
556  @retval
557  0 OK
558  @retval
559  -1 Error
560  */
562 
563  /* Constructor for this class.*/
566 #ifdef HAVE_PSI_INTERFACE
568 #endif
569  );
570  }
571 
572  /* Destructor for this class. */
574 
575  /**
576  Traverse the filter map and free all filters. Delete all objects
577  in the rpl_pfs_filter_vec vector and then clear the vector.
578  */
579  void clean_up() {
580  /* Traverse the filter map and free all filters */
581  for (filter_map::iterator it = channel_to_filter.begin();
582  it != channel_to_filter.end(); it++) {
583  if (it->second != nullptr) {
584  delete it->second;
585  it->second = nullptr;
586  }
587  }
588 
589  rpl_pfs_filter_vec.clear();
590  }
591 
592  /**
593  Acquire the write lock.
594  */
595  inline void wrlock() { m_channel_to_filter_lock->wrlock(); }
596 
597  /**
598  Acquire the read lock.
599  */
600  inline void rdlock() { m_channel_to_filter_lock->rdlock(); }
601 
602  /**
603  Release the lock (whether it is a write or read lock).
604  */
605  inline void unlock() { m_channel_to_filter_lock->unlock(); }
606 };
607 
608 /* Global object for multisourced slave. */
610 
611 /* Global object for storing per-channel replication filters */
613 
614 static bool inline is_slave_configured() {
615  /* Server was started with server_id == 0
616  OR
617  failure to load slave info repositories because of repository
618  mismatch i.e Assume slave had a multisource replication with several
619  channels setup with TABLE repository. Then if the slave is restarted
620  with FILE repository, we fail to load any of the slave repositories,
621  including the default channel one.
622  Hence, channel_map.get_default_channel_mi() will return NULL.
623  */
624  return (channel_map.get_default_channel_mi() != nullptr);
625 }
626 
627 #endif /*RPL_MSR_H*/
This has the functionality of mysql_rwlock_t, with two differences:
Definition: rpl_gtid.h:306
int trywrlock()
Return 0 if the write lock is held, otherwise an error will be returned.
Definition: rpl_gtid.h:493
void rdlock()
Acquire the read lock.
Definition: rpl_gtid.h:441
void wrlock()
Acquire the write lock.
Definition: rpl_gtid.h:450
int tryrdlock()
Return 0 if the read lock is held, otherwise an error will be returned.
Definition: rpl_gtid.h:512
void assert_some_lock() const
Assert that some thread holds either the read or the write lock.
Definition: rpl_gtid.h:527
void unlock()
Release the lock (whether it is a write or read lock).
Definition: rpl_gtid.h:461
void assert_some_wrlock() const
Assert that some thread holds the write lock.
Definition: rpl_gtid.h:531
Definition: rpl_mi.h:86
bool is_source_connection_auto_failover()
Checks if Asynchronous Replication Connection Failover feature is enabled.
Definition: rpl_mi.h:512
static bool is_configured(Master_info *mi)
Definition: rpl_mi.h:103
Class to store all the Master_info objects of a slave to access them in the replication code base or ...
Definition: rpl_msr.h:112
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:216
void 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:116
bool is_group_replication_channel_name(const char *channel, bool is_applier=false)
Returns if a channel name is one of the reserved group replication names.
Definition: rpl_msr.cc:174
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:185
Multisource_info()
Definition: rpl_msr.h:154
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:269
mi_map::iterator end(enum_channel_type channel_type=SLAVE_REPLICATION_CHANNEL)
Definition: rpl_msr.h:346
void assert_some_lock() const
Assert that some thread holds either the read or the write lock.
Definition: rpl_msr.h:431
static const char * group_replication_channel_names[]
Definition: rpl_msr.h:129
void wrlock()
Acquire the write lock.
Definition: rpl_msr.h:413
static const char * default_channel
Default_channel for this instance, currently is predefined and cannot be modified.
Definition: rpl_msr.h:127
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:421
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:203
uint get_max_channels()
Get max channels allowed for this map.
Definition: rpl_msr.h:302
void init_rpl_pfs_mi()
Definition: rpl_msr.h:362
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:137
Master_info * default_channel_mi
Definition: rpl_msr.h:128
uint current_mi_count
Definition: rpl_msr.h:121
~Multisource_info()
Definition: rpl_msr.h:178
void rdlock()
Acquire the read lock.
Definition: rpl_msr.h:400
void assert_some_wrlock() const
Assert that some thread holds the write lock.
Definition: rpl_msr.h:438
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:40
void unlock()
Release the lock (whether it is a write or read lock).
Definition: rpl_msr.h:426
mi_map::iterator begin(enum_channel_type channel_type=SLAVE_REPLICATION_CHANNEL)
Forward iterators to initiate traversing of a map.
Definition: rpl_msr.h:334
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:85
const char * get_default_channel()
Get the default channel for this multisourced_slave;.
Definition: rpl_msr.h:226
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:308
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:408
Master_info * get_default_channel_mi()
Return the master_info object corresponding to the default channel.
Definition: rpl_msr.h:208
Master_info * rpl_pfs_mi[MAX_CHANNELS]
Definition: rpl_msr.h:142
replication_channel_map rep_channel_map
Definition: rpl_msr.h:118
mi_map empty_mi_map
Definition: rpl_msr.h:150
static const unsigned int MAX_CHANNELS
Definition: rpl_msr.h:115
size_t get_num_instances(bool all=false)
Get the number of instances of Master_info in the map.
Definition: rpl_msr.h:236
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:465
Checkable_rwlock * m_channel_to_filter_lock
Definition: rpl_msr.h:487
uint get_filter_count()
Used only by replication performance schema indices to get the count of replication filters from the ...
Definition: rpl_msr.cc:373
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:363
Rpl_filter * get_channel_filter(const char *channel_name)
Get a replication filter of a channel.
Definition: rpl_msr.cc:325
std::vector< Rpl_pfs_filter > rpl_pfs_filter_vec
Definition: rpl_msr.h:470
void reset_pfs_view()
This member function is called everytime a filter is created or deleted, or its filter rules are chan...
Definition: rpl_msr.cc:348
void clean_up()
Traverse the filter map and free all filters.
Definition: rpl_msr.h:579
void unlock()
Release the lock (whether it is a write or read lock).
Definition: rpl_msr.h:605
void delete_filter(Rpl_filter *rpl_filter)
Delete the replication filter from the filter map.
Definition: rpl_msr.cc:255
void discard_group_replication_filters()
discard filters on group replication channels.
Definition: rpl_msr.cc:276
void discard_all_unattached_filters()
Discard all replication filters if they are not attached to channels.
Definition: rpl_msr.cc:294
Rpl_channel_filters()
Definition: rpl_msr.h:564
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:382
filter_map channel_to_filter
Definition: rpl_msr.h:468
Rpl_filter * create_filter(const char *channel_name)
Create a new replication filter and add it into a filter map.
Definition: rpl_msr.cc:226
~Rpl_channel_filters()
Definition: rpl_msr.h:573
void wrlock()
Acquire the write lock.
Definition: rpl_msr.h:595
void rdlock()
Acquire the read lock.
Definition: rpl_msr.h:600
Rpl_filter.
Definition: rpl_filter.h:213
std::atomic< uint > slave_running
Definition: rpl_info.h:81
The class Rpl_pfs_filter is introduced to serve the performance_schema.replication_applier_filters ta...
Definition: rpl_filter.h:166
mysql_mutex_t err_lock
lock used to synchronize m_last_error on 'SHOW SLAVE STATUS'
Definition: rpl_reporting.h:55
bool is_error() const
Definition: rpl_reporting.h:137
static Source_IO_monitor * get_instance()
Fetch Source_IO_monitor class instance.
Definition: rpl_io_monitor.cc:1086
#define mysql_mutex_lock(M)
Definition: mysql_mutex.h:49
#define mysql_mutex_unlock(M)
Definition: mysql_mutex.h:56
DBUG_TRACE
Definition: do_ctype.cc:46
char * pos
Definition: do_ctype.cc:76
#define DBUG_EXECUTE_IF(keyword, a1)
Definition: my_dbug.h:158
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
#define HAVE_PSI_INTERFACE
Definition: my_psi_config.h:38
static int count
Definition: myisam_ftdump.cc:42
PSI_rwlock_key key_rwlock_channel_to_filter_lock
Definition: mysqld.cc:11254
PSI_rwlock_key key_rwlock_channel_map_lock
Definition: mysqld.cc:11250
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:94
enum_channel_type
Types of channels.
Definition: rpl_channel_service_interface.h:50
@ SLAVE_REPLICATION_CHANNEL
Definition: rpl_channel_service_interface.h:51
Rpl_filter * rpl_filter
std::map< std::string, Master_info * > mi_map
Maps a channel name to it's Master_info.
Definition: rpl_msr.h:44
static bool is_slave_configured()
Definition: rpl_msr.h:614
std::map< std::string, Rpl_filter * > filter_map
Definition: rpl_msr.h:55
Multisource_info channel_map
Definition: rpl_msr.cc:403
std::map< int, mi_map > replication_channel_map
Definition: rpl_msr.h:53
Rpl_channel_filters rpl_channel_filters
Definition: rpl_msr.cc:405
Definition: task.h:425
unsigned int uint
Definition: uca-dump.cc:29
static int all(site_def const *s, node_no node)
Definition: xcom_transport.cc:858