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