MySQL  8.0.17
Source Code Documentation
rpl_mi.h
Go to the documentation of this file.
1 /* Copyright (c) 2006, 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_MI_H
24 #define RPL_MI_H
25 
26 #include <sys/types.h>
27 #include <time.h>
28 #include <atomic>
29 
30 #include "binlog_event.h" // enum_binlog_checksum_alg
31 #include "m_string.h"
32 #include "my_inttypes.h"
33 #include "my_io.h"
34 #include "my_psi_config.h"
36 #include "mysql/psi/mysql_mutex.h"
37 #include "mysql_com.h"
38 #include "sql/binlog.h"
39 #include "sql/log_event.h" // Format_description_log_event
40 #include "sql/rpl_gtid.h" // Gtid
41 #include "sql/rpl_info.h" // Rpl_info
42 #include "sql/rpl_rli.h" // rli->get_log_lock()
43 #include "sql/rpl_trx_boundary_parser.h" // Transaction_boundary_parser
44 #include "sql/sql_const.h"
45 
46 class Rpl_info_handler;
47 class Server_ids;
48 class THD;
49 struct MYSQL;
50 
51 #define DEFAULT_CONNECT_RETRY 60
52 
53 /*****************************************************************************
54  Replication IO Thread
55 
56  Master_info contains:
57  - information about how to connect to a master
58  - current master log name
59  - current master log offset
60  - misc control variables
61 
62  Master_info is initialized once from the master.info repository if such
63  exists. Otherwise, data members corresponding to master.info fields
64  are initialized with defaults specified by master-* options. The
65  initialization is done through mi_init_info() call.
66 
67  Logically, the format of master.info repository is presented as follows:
68 
69  log_name
70  log_pos
71  master_host
72  master_user
73  master_pass
74  master_port
75  master_connect_retry
76 
77  To write out the contents of master.info to disk a call to flush_info()
78  is required. Currently, it is needed every time we read and queue data
79  from the master.
80 
81  To clean up, call end_info()
82 
83 *****************************************************************************/
84 
85 class Master_info : public Rpl_info, public Gtid_mode_copy {
86  friend class Rpl_info_factory;
87 
88  public:
89  /**
90  Host name or ip address stored in the master.info.
91  */
92  char host[HOSTNAME_LENGTH + 1];
93 
94  /*
95  Check if the channel is configured.
96 
97  @param mi Pointer to Master_info.
98 
99  @retval true The channel is configured.
100  @retval false The channel is not configured.
101  */
102  static bool is_configured(Master_info *mi) { return mi && mi->host[0]; }
103 
104  private:
105  /**
106  If true, USER/PASSWORD was specified when running START SLAVE.
107  */
109  /**
110  User's name stored in the master.info.
111  */
113  /**
114  User's password stored in the master.info.
115  */
117  /**
118  User specified when running START SLAVE.
119  */
121  /**
122  Password specified when running START SLAVE.
123  */
125  /**
126  Stores the autentication plugin specified when running START SLAVE.
127  */
129  /**
130  Stores the autentication plugin directory specified when running
131  START SLAVE.
132  */
134 
135  /// Information on the current and last queued transactions
137 
138 #ifdef HAVE_PSI_INTERFACE
139  /**
140  PSI key for the `rotate_lock`
141  */
143  /**
144  PSI key for the `rotate_cond`
145  */
147 #endif
148  /**
149  Lock to protect from rotating the relay log when in the middle of a
150  transaction.
151  */
153  /**
154  Waiting condition that will block the process/thread requesting a relay log
155  rotation in the middle of a transaction. The process/thread will wait until
156  the transaction is written to the relay log and the rotation is,
157  successfully accomplished.
158  */
160  /**
161  If a rotate was requested while the relay log was in a transaction.
162  */
163  std::atomic<bool> rotate_requested{false};
164 
165  public:
166  /**
167  Returns if USER/PASSWORD was specified when running
168  START SLAVE.
169 
170  @return true or false.
171  */
173  /**
174  Returns if DEFAULT_AUTH was specified when running START SLAVE.
175 
176  @return true or false.
177  */
179  return (start_plugin_auth[0] != 0);
180  }
181  /**
182  Returns if PLUGIN_DIR was specified when running START SLAVE.
183 
184  @return true or false.
185  */
187  return (start_plugin_dir[0] != 0);
188  }
189  /**
190  Defines that USER/PASSWORD was specified or not when running
191  START SLAVE.
192 
193  @param config is true or false.
194  */
197  }
198  /**
199  Sets either user's name in the master.info repository when CHANGE
200  MASTER is executed or user's name used in START SLAVE if USER is
201  specified.
202 
203  @param user_arg is user's name.
204  */
205  void set_user(const char *user_arg) {
206  if (user_arg && start_user_configured) {
207  strmake(start_user, user_arg, sizeof(start_user) - 1);
208  } else if (user_arg) {
209  strmake(user, user_arg, sizeof(user) - 1);
210  }
211  }
212  /**
213  Returns user's size name. See @c get_user().
214 
215  @return user's size name.
216  */
217  size_t get_user_size() const {
218  return (start_user_configured ? sizeof(start_user) : sizeof(user));
219  }
220  /**
221  If an user was specified when running START SLAVE, this function returns
222  such user. Otherwise, it returns the user stored in master.info.
223 
224  @return user's name.
225  */
226  const char *get_user() const {
228  }
229  /**
230  Stores either user's password in the master.info repository when CHANGE
231  MASTER is executed or user's password used in START SLAVE if PASSWORD
232  is specified.
233 
234  @param password_arg is user's password.
235 
236  */
237  void set_password(const char *password_arg);
238  /**
239  Returns either user's password in the master.info repository or
240  user's password used in START SLAVE.
241 
242  @param[out] password_arg is user's password.
243  @param[out] password_arg_size is user's password size.
244 
245  @return false if there is no error, otherwise true is returned.
246  */
247  bool get_password(char *password_arg, size_t *password_arg_size);
248  /**
249  Cleans in-memory password defined by START SLAVE.
250  */
251  void reset_start_info();
252  /**
253  Returns the DEFAULT_AUTH defined by START SLAVE.
254 
255  @return DEFAULT_AUTH.
256  */
257  const char *get_start_plugin_auth() { return start_plugin_auth; }
258  /**
259  Returns the PLUGIN_DIR defined by START SLAVE.
260 
261  @return PLUGIN_DIR.
262  */
263  const char *get_start_plugin_dir() { return start_plugin_dir; }
264  /**
265  Stores the DEFAULT_AUTH defined by START SLAVE.
266  */
267  void set_plugin_auth(const char *src) {
268  if (src) strmake(start_plugin_auth, src, sizeof(start_plugin_auth) - 1);
269  }
270  /**
271  Stores the DEFAULT_AUTH defined by START SLAVE.
272  */
273  void set_plugin_dir(const char *src) {
274  if (src) strmake(start_plugin_dir, src, sizeof(start_plugin_dir) - 1);
275  }
276 
277  bool ssl; // enables use of SSL connection if true
284 
286  uint32 file_id; /* for 3.23 load data infile */
290  /*
291  The difference in seconds between the clock of the master and the clock of
292  the slave (second - first). It must be signed as it may be <0 or >0.
293  clock_diff_with_master is computed when the I/O thread starts; for this the
294  I/O thread does a SELECT UNIX_TIMESTAMP() on the master.
295  "how late the slave is compared to the master" is computed like this:
296  clock_of_slave - last_timestamp_executed_by_SQL_thread -
297  clock_diff_with_master
298 
299  */
301  float heartbeat_period; // interface with CHANGE MASTER or master.info
302  ulonglong received_heartbeats; // counter of received heartbeat events
303 
305 
307 
309  /*
310  to hold checksum alg in use until IO thread has received FD.
311  Initialized to novalue, then set to the queried from master
312  @@global.binlog_checksum and deactivated once FD has been received.
313  */
318 
319  /*
320  Name of a network namespace where a socket for connection to a master
321  should be created.
322  */
324 
325  bool is_set_network_namespace() const { return network_namespace[0] != 0; }
326 
327  const char *network_namespace_str() const {
329  }
330 
331  int mi_init_info();
332  void end_info();
333  int flush_info(bool force = false);
335 
336  bool shall_ignore_server_id(ulong s_id);
337 
338  /*
339  A buffer to hold " for channel <channel_name>
340  used in error messages per channel
341  */
344 
345  /**
346  @return The pointer to the Gtid_monitoring_info
347  */
349  return gtid_monitoring_info;
350  }
351 
352  /**
353  Stores the details of the transaction the receiver thread has just started
354  queueing.
355 
356  @param gtid_arg the gtid of the trx
357  @param original_ts_arg the original commit timestamp of the transaction
358  @param immediate_ts_arg the immediate commit timestamp of the transaction
359  */
360  void started_queueing(Gtid gtid_arg, ulonglong original_ts_arg,
361  ulonglong immediate_ts_arg) {
362  gtid_monitoring_info->start(gtid_arg, original_ts_arg, immediate_ts_arg);
363  }
364 
365  /**
366  When the receiver thread finishes queueing a transaction, that timestamp
367  is recorded and the information is copied to last_queued_trx and cleared
368  from queueing_trx.
369  */
371 
372  /**
373  @return True if there is a transaction currently being queued
374  */
377  }
378 
379  /**
380  @return The pointer to the GTID of the processing_trx of
381  Gtid_monitoring_info.
382  */
385  }
386 
387  /**
388  Clears the processing_trx monitoring info.
389 
390  Normally called when there is an error while queueing the transaction.
391  */
392  void clear_queueing_trx(bool need_lock = false) {
393  if (need_lock) mysql_mutex_lock(&data_lock);
395  if (need_lock) mysql_mutex_unlock(&data_lock);
396  }
397 
398  /**
399  Clears all GTID monitoring info.
400  */
401  void clear_gtid_monitoring_info(bool need_lock = false) {
402  if (need_lock) mysql_mutex_lock(&data_lock);
404  if (need_lock) mysql_mutex_unlock(&data_lock);
405  }
406 
407  virtual ~Master_info();
408 
409  /**
410  Sets the flag that indicates that a relay log rotation has been requested.
411 
412  @param[in] thd the client thread carrying the command.
413  */
414  void request_rotate(THD *thd);
415  /**
416  Clears the flag that indicates that a relay log rotation has been requested
417  and notifies requester that the rotation has finished.
418  */
419  void clear_rotate_requests();
420  /**
421  Checks whether or not there is a request for rotating the underlying relay
422  log.
423 
424  @returns true if there is, false otherwise
425  */
426  bool is_rotate_requested();
427 
428  protected:
431 
432  public:
433  inline const char *get_master_log_name() { return master_log_name; }
435  inline void set_master_log_name(const char *log_file_name) {
436  strmake(master_log_name, log_file_name, sizeof(master_log_name) - 1);
437  }
438  inline void set_master_log_pos(ulonglong log_pos) {
439  master_log_pos = log_pos;
440  }
441  inline const char *get_io_rpl_log_name() {
442  return (master_log_name[0] ? master_log_name : "FIRST");
443  }
444  static size_t get_number_info_mi_fields();
445 
446  /**
447  returns the column number of a channel in the TABLE repository.
448  Mainly used during server startup to load the information required
449  from the slave repostiory tables. See rpl_info_factory.cc
450  */
451  static uint get_channel_field_num();
452 
453  /**
454  Returns an array with the expected column names of the primary key
455  fields of the table repository.
456  */
457  static const char **get_table_pk_field_names();
458 
459  /**
460  Returns an array with the expected column numbers of the primary key
461  fields of the table repository.
462  */
463  static const uint *get_table_pk_field_indexes();
464 
465  bool is_auto_position() { return auto_position; }
466 
467  void set_auto_position(bool auto_position_param) {
468  auto_position = auto_position_param;
469  }
470 
471  /**
472  This member function shall return true if there are server
473  ids configured to be ignored.
474 
475  @return true if there are server ids to be ignored,
476  false otherwise.
477  */
479 
480  private:
481  /**
482  Format_description_log_event for events received from the master
483  by the IO thread and written to the tail of the relay log.
484 
485  Use patterns:
486  - Created when the IO thread starts and destroyed when the IO
487  thread stops.
488  - Updated when the IO thread receives a
489  Format_description_log_event.
490  - Accessed by the IO thread when it de-serializes events (e.g.,
491  rotate events, Gtid events).
492  - Written by the IO thread to the new relay log on every rotation.
493  - Written by a client that executes FLUSH LOGS to the new relay
494  log on every rotation.
495 
496  Locks:
497  All access is protected by Relay_log::LOCK_log.
498  */
500 
501  public:
504  return mi_description_event;
505  }
508  delete mi_description_event;
509  mi_description_event = fdle;
510  }
511 
513 
514  virtual const char *get_for_channel_str(bool upper_case = false) const {
515  return reinterpret_cast<const char *>(upper_case ? for_channel_uppercase_str
516  : for_channel_str);
517  }
518 
519  void init_master_log_pos();
520 
521  private:
522  bool read_info(Rpl_info_handler *from);
523  bool write_info(Rpl_info_handler *to);
524 
526 
527  Master_info(
528 #ifdef HAVE_PSI_INTERFACE
529  PSI_mutex_key *param_key_info_run_lock,
530  PSI_mutex_key *param_key_info_data_lock,
531  PSI_mutex_key *param_key_info_sleep_lock,
532  PSI_mutex_key *param_key_info_thd_lock,
533  PSI_mutex_key *param_key_info_rotate_lock,
534  PSI_mutex_key *param_key_info_data_cond,
535  PSI_mutex_key *param_key_info_start_cond,
536  PSI_mutex_key *param_key_info_stop_cond,
537  PSI_mutex_key *param_key_info_sleep_cond,
538  PSI_mutex_key *param_key_info_rotate_cond,
539 #endif
540  uint param_id, const char *param_channel);
541 
542  Master_info(const Master_info &info);
544 
545  public:
546  /*
547  This will be used to verify transactions boundaries of events sent by the
548  master server.
549  It will also be used to verify transactions boundaries on the relay log
550  while collecting the Retrieved_Gtid_Set to make sure of only adding GTIDs
551  of fully retrieved transactions.
552  */
554 
555  private:
556  /*
557  This is the channel lock. It is a rwlock used to serialize all replication
558  administrative commands that cannot be performed concurrently for a given
559  replication channel:
560  - START SLAVE;
561  - STOP SLAVE;
562  - CHANGE MASTER;
563  - RESET SLAVE;
564  - end_slave() (when mysqld stops)).
565  Any of these commands must hold the wrlock from the start till the end.
566  */
568 
569  /* References of the channel, the channel can only be deleted when it is 0. */
570  std::atomic<int32> atomic_references{0};
571 
572  public:
573  /**
574  Acquire the channel read lock.
575  */
576  void channel_rdlock();
577 
578  /**
579  Acquire the channel write lock.
580  */
581  void channel_wrlock();
582 
583  /**
584  Release the channel lock (whether it is a write or read lock).
585  */
586  inline void channel_unlock() { m_channel_lock->unlock(); }
587 
588  /**
589  Assert that some thread holds either the read or the write lock.
590  */
591  inline void channel_assert_some_lock() const {
593  }
594 
595  /**
596  Assert that some thread holds the write lock.
597  */
598  inline void channel_assert_some_wrlock() const {
600  }
601 
602  /**
603  Increase the reference count to prohibit deleting a channel. This function
604  must be protected by channel_map.rdlock(). dec_reference has to be
605  called in conjunction with inc_reference().
606  */
608 
609  /**
610  Decrease the reference count. Doesn't need the protection of
611  channel_map.rdlock.
612  */
614 
615  /**
616  It mush be called before deleting a channel and protected by
617  channel_map_lock.wrlock().
618 
619  @param thd the THD object of current thread
620  */
621  void wait_until_no_reference(THD *thd);
622 
623  /* Set true when the Master_info object was cleared by a RESET SLAVE */
624  bool reset;
625 
626  /**
627  Sync flushed_relay_log_info with current relay log coordinates.
628 
629  It will sync the receiver thread relay log coordinates (file name and
630  position) with the last master coordinates that were flushed into the
631  Master_info repository.
632 
633  This function shall be called by Master_info::flush_info() at the end of a
634  successful flush of the Master_info content into the repository while still
635  holding the data_lock.
636 
637  It is also called my load_mi_and_rli_from_repositories(), right after the
638  successful call to rli_init_info() that opens the relay log.
639  */
640 
642 
643  /**
644  Collect relay log coordinates (file name and position) that related to the
645  last Master_info master coordinates flushed into the repository.
646 
647  @param [out] linfo Where the relay log coordinates shall be stored.
648  */
649 
651 
652  private:
653  /*
654  Holds the relay log coordinates (file name and position) of the last master
655  coordinates flushed into Master_info repository.
656  */
658 };
659 
660 #endif /* RPL_MI_H */
char ssl_cert[FN_REFLEN]
Definition: rpl_mi.h:278
bool ssl
Definition: rpl_mi.h:277
unsigned long long int ulonglong
Definition: my_inttypes.h:74
char ssl_cipher[FN_REFLEN]
Definition: rpl_mi.h:279
Relay_log_info * rli
Definition: rpl_mi.h:287
mysql_mutex_t rotate_lock
Lock to protect from rotating the relay log when in the middle of a transaction.
Definition: rpl_mi.h:152
Instrumentation helpers for mutexes.
#define USERNAME_LENGTH
Definition: mysql_com.h:66
int flush_info(bool force=false)
Store the master file and position where the slave&#39;s I/O thread are in the relay log.
Definition: rpl_mi.cc:346
my_off_t master_log_pos
Definition: rpl_mi.h:430
void set_plugin_dir(const char *src)
Stores the DEFAULT_AUTH defined by START SLAVE.
Definition: rpl_mi.h:273
void channel_assert_some_lock() const
Assert that some thread holds either the read or the write lock.
Definition: rpl_mi.h:591
Definition: default_engine.h:52
const char * get_io_rpl_log_name()
Definition: rpl_mi.h:441
void started_queueing(Gtid gtid_arg, ulonglong original_ts_arg, ulonglong immediate_ts_arg)
Stores the details of the transaction the receiver thread has just started queueing.
Definition: rpl_mi.h:360
bool shall_ignore_server_id(ulong s_id)
Reports if the s_id server has been configured to ignore events it generates with.
Definition: rpl_mi.cc:299
char bind_addr[HOSTNAME_LENGTH+1]
Definition: rpl_mi.h:317
static const uint * get_table_pk_field_indexes()
Returns an array with the expected column numbers of the primary key fields of the table repository...
Definition: rpl_mi.cc:427
bool is_rotate_requested()
Checks whether or not there is a request for rotating the underlying relay log.
Definition: rpl_mi.cc:282
bool is_ignore_server_ids_configured()
This member function shall return true if there are server ids configured to be ignored.
Definition: rpl_mi.cc:687
bool is_queueing_trx()
Definition: rpl_mi.h:375
void finish()
Sets the final information, copy processing info to last_processed and clears processing info...
Definition: rpl_gtid_misc.cc:509
An instrumented cond structure.
Definition: mysql_cond_bits.h:49
File containing constants that can be used throughout the server.
long clock_diff_with_master
Definition: rpl_mi.h:300
size_t get_user_size() const
Returns user&#39;s size name.
Definition: rpl_mi.h:217
Definition: rpl_info_handler.h:55
Some integer typedefs for easier portability.
uint connect_retry
Definition: rpl_mi.h:289
bool is_start_plugin_dir_configured() const
Returns if PLUGIN_DIR was specified when running START SLAVE.
Definition: rpl_mi.h:186
void clear_gtid_monitoring_info(bool need_lock=false)
Clears all GTID monitoring info.
Definition: rpl_mi.h:401
PSI_mutex_key * key_info_rotate_cond
PSI key for the rotate_cond
Definition: rpl_mi.h:146
void set_user(const char *user_arg)
Sets either user&#39;s name in the master.info repository when CHANGE MASTER is executed or user&#39;s name u...
Definition: rpl_mi.h:205
Contains the classes representing events occurring in the replication stream.
char network_namespace[NAME_LEN]
Definition: rpl_mi.h:323
const char * get_user() const
If an user was specified when running START SLAVE, this function returns such user.
Definition: rpl_mi.h:226
int mi_init_info()
Creates or reads information from the repository, initializing the Master_info.
Definition: rpl_mi.cc:387
char master_log_name[FN_REFLEN]
Definition: rpl_mi.h:429
Gtid_monitoring_info * get_gtid_monitoring_info()
Definition: rpl_mi.h:348
Gtid_monitoring_info * gtid_monitoring_info
Information on the current and last queued transactions.
Definition: rpl_mi.h:136
For binlog version 4.
Definition: log_event.h:1458
static size_t get_number_info_mi_fields()
Definition: rpl_mi.cc:418
void set_master_log_name(const char *log_file_name)
Definition: rpl_mi.h:435
Transaction boundary parser definitions.
An optimized way of checking GTID_MODE without acquiring locks every time.
Definition: rpl_gtid.h:3890
Definition: dynamic_ids.h:32
#define NAME_LEN
Definition: mysql_com.h:64
void assert_some_wrlock() const
Assert that some thread holds the write lock.
Definition: rpl_gtid.h:526
void reset_start_info()
Cleans in-memory password defined by START SLAVE.
Definition: rpl_mi.cc:656
TODO: Move this structure to libbinlogevents/include/control_events.h when we start using C++11...
Definition: rpl_gtid.h:924
char password[MAX_PASSWORD_LENGTH+1]
User&#39;s password stored in the master.info.
Definition: rpl_mi.h:116
Definition: rpl_info_factory.h:42
const char * get_start_plugin_auth()
Returns the DEFAULT_AUTH defined by START SLAVE.
Definition: rpl_mi.h:257
Master_info(PSI_mutex_key *param_key_info_run_lock, PSI_mutex_key *param_key_info_data_lock, PSI_mutex_key *param_key_info_sleep_lock, PSI_mutex_key *param_key_info_thd_lock, PSI_mutex_key *param_key_info_rotate_lock, PSI_mutex_key *param_key_info_data_cond, PSI_mutex_key *param_key_info_start_cond, PSI_mutex_key *param_key_info_stop_cond, PSI_mutex_key *param_key_info_sleep_cond, PSI_mutex_key *param_key_info_rotate_cond, uint param_id, const char *param_channel)
Definition: rpl_mi.cc:136
static uint get_channel_field_num()
returns the column number of a channel in the TABLE repository.
Definition: rpl_mi.cc:422
MYSQL * mysql
Definition: rpl_mi.h:285
void init_master_log_pos()
Definition: rpl_mi.cc:304
bool ssl_verify_server_cert
Definition: rpl_mi.h:282
void set_mi_description_event(Format_description_log_event *fdle)
Definition: rpl_mi.h:506
virtual ~Master_info()
Definition: rpl_mi.cc:218
unsigned int PSI_mutex_key
Instrumented mutex key.
Definition: psi_mutex_bits.h:49
Common definition between mysql server & client.
mysql_mutex_t * get_log_lock()
Definition: binlog.h:849
bool is_auto_position()
Definition: rpl_mi.h:465
char ssl_crl[FN_REFLEN]
Definition: rpl_mi.h:280
Definition: rpl_info.h:42
char host[HOSTNAME_LENGTH+1]
Host name or ip address stored in the master.info.
Definition: rpl_mi.h:92
void clear_queueing_trx(bool need_lock=false)
Clears the processing_trx monitoring info.
Definition: rpl_mi.h:392
mysql_cond_t rotate_cond
Waiting condition that will block the process/thread requesting a relay log rotation in the middle of...
Definition: rpl_mi.h:159
const char * get_start_plugin_dir()
Returns the PLUGIN_DIR defined by START SLAVE.
Definition: rpl_mi.h:263
char * strmake(char *dst, const char *src, size_t length)
Definition: strmake.cc:42
bool is_start_user_configured() const
Returns if USER/PASSWORD was specified when running START SLAVE.
Definition: rpl_mi.h:172
bool set_info_search_keys(Rpl_info_handler *to)
To search in the slave repositories, each slave info object (mi, rli or worker) should use a primary ...
Definition: rpl_mi.cc:589
Definition: rpl_rli.h:164
void assert_some_lock() const
Assert that some thread holds either the read or the write lock.
Definition: rpl_gtid.h:522
ulonglong received_heartbeats
Definition: rpl_mi.h:302
void clear_rotate_requests()
Clears the flag that indicates that a relay log rotation has been requested and notifies requester th...
Definition: rpl_mi.cc:258
void unlock()
Release the lock (whether it is a write or read lock).
Definition: rpl_gtid.h:473
void set_auto_position(bool auto_position_param)
Definition: rpl_mi.h:467
void set_master_log_pos(ulonglong log_pos)
Definition: rpl_mi.h:438
static const char ** get_table_pk_field_names()
Returns an array with the expected column names of the primary key fields of the table repository...
void update_flushed_relay_log_info()
Sync flushed_relay_log_info with current relay log coordinates.
Definition: rpl_mi.cc:691
Format_description_log_event * get_mi_description_event()
Definition: rpl_mi.h:502
This is the base class for verifying transaction boundaries in a replication event stream...
Definition: rpl_trx_boundary_parser.h:49
Format_description_log_event * mi_description_event
Format_description_log_event for events received from the master by the IO thread and written to the ...
Definition: rpl_mi.h:499
void set_password(const char *password_arg)
Stores either user&#39;s password in the master.info repository when CHANGE MASTER is executed or user&#39;s ...
Definition: rpl_mi.cc:627
std::atomic< bool > rotate_requested
If a rotate was requested while the relay log was in a transaction.
Definition: rpl_mi.h:163
void channel_rdlock()
Acquire the channel read lock.
Definition: rpl_mi.cc:666
void request_rotate(THD *thd)
Sets the flag that indicates that a relay log rotation has been requested.
Definition: rpl_mi.cc:235
const Gtid * get_processing_trx_gtid()
Returns the GTID of the processing_trx.
Definition: rpl_gtid_misc.cc:548
void set_plugin_auth(const char *src)
Stores the DEFAULT_AUTH defined by START SLAVE.
Definition: rpl_mi.h:267
void channel_unlock()
Release the channel lock (whether it is a write or read lock).
Definition: rpl_mi.h:586
char for_channel_str[CHANNEL_NAME_LENGTH+31]
Definition: rpl_mi.h:342
Definition: binlog.h:303
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
bool is_processing_trx_set()
Returns true if the processing_trx is set, false otherwise.
Definition: rpl_gtid_misc.cc:539
char ssl_crlpath[FN_REFLEN]
Definition: rpl_mi.h:280
char tls_version[FN_REFLEN]
Definition: rpl_mi.h:279
unsigned int uint
Definition: uca-dump.cc:29
#define FN_REFLEN
Definition: my_io.h:82
MYSQL_BIN_LOG relay_log
Definition: rpl_rli.h:222
mysql_mutex_t data_lock
Definition: rpl_info.h:57
char user[USERNAME_LENGTH+1]
User&#39;s name stored in the master.info.
Definition: rpl_mi.h:112
binary_log::enum_binlog_checksum_alg checksum_alg_before_fd
Definition: rpl_mi.h:314
static constexpr int HOSTNAME_LENGTH
Definition: my_hostname.h:42
ulong master_id
Definition: rpl_mi.h:308
uint32_t uint32
Definition: my_inttypes.h:62
const char * get_master_log_name()
Definition: rpl_mi.h:433
void start(Gtid gtid_arg, ulonglong original_ts_arg, ulonglong immediate_ts_arg, bool skipped_arg=false)
Sets the initial monitoring information.
Definition: rpl_gtid_misc.cc:473
void clear()
Clear all monitoring information.
Definition: rpl_gtid_misc.cc:454
Master_info & operator=(const Master_info &info)
ulonglong last_heartbeat
Definition: rpl_mi.h:304
Instrumentation helpers for mutexes.
Checkable_rwlock * m_channel_lock
Definition: rpl_mi.h:567
char ssl_key[FN_REFLEN]
Definition: rpl_mi.h:279
uint32 file_id
Definition: rpl_mi.h:286
#define HAVE_PSI_INTERFACE
Definition: my_psi_config.h:38
void end_info()
Definition: rpl_mi.cc:315
Binary log event definitions.
std::atomic< int32 > atomic_references
Definition: rpl_mi.h:570
const char * network_namespace_str() const
Definition: rpl_mi.h:327
unsigned long my_off_t
Definition: my_inttypes.h:87
void dec_reference()
Decrease the reference count.
Definition: rpl_mi.h:613
void inc_reference()
Increase the reference count to prohibit deleting a channel.
Definition: rpl_mi.h:607
void wait_until_no_reference(THD *thd)
It mush be called before deleting a channel and protected by channel_map_lock.wrlock().
Definition: rpl_mi.cc:676
char start_user[USERNAME_LENGTH+1]
User specified when running START SLAVE.
Definition: rpl_mi.h:120
void set_relay_log_info(Relay_log_info *info)
Definition: rpl_mi.cc:381
Stores information to monitor a transaction during the different replication stages.
Definition: rpl_gtid.h:1161
char start_password[MAX_PASSWORD_LENGTH+1]
Password specified when running START SLAVE.
Definition: rpl_mi.h:124
char for_channel_uppercase_str[CHANNEL_NAME_LENGTH+31]
Definition: rpl_mi.h:343
bool start_user_configured
If true, USER/PASSWORD was specified when running START SLAVE.
Definition: rpl_mi.h:108
Definition: rpl_mi.h:85
char ssl_capath[FN_REFLEN]
Definition: rpl_mi.h:278
void channel_wrlock()
Acquire the channel write lock.
Definition: rpl_mi.cc:671
char start_plugin_auth[FN_REFLEN+1]
Stores the autentication plugin specified when running START SLAVE.
Definition: rpl_mi.h:128
bool get_public_key
Definition: rpl_mi.h:283
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:49
Transaction_boundary_parser transaction_parser
Definition: rpl_mi.h:553
Server_ids * ignore_server_ids
Definition: rpl_mi.h:306
void set_start_user_configured(bool config)
Defines that USER/PASSWORD was specified or not when running START SLAVE.
Definition: rpl_mi.h:195
Common #defines and includes for file and socket I/O.
#define mysql_mutex_assert_owner(M)
Wrapper, to use safe_mutex_assert_owner with instrumented mutexes.
Definition: mysql_mutex.h:109
#define UUID_LENGTH
Definition: sql_const.h:411
ulonglong get_master_log_pos()
Definition: rpl_mi.h:434
#define mysql_mutex_unlock(M)
Definition: mysql_mutex.h:53
LOG_INFO flushed_relay_log_info
Definition: rpl_mi.h:657
#define mysql_mutex_lock(M)
Definition: mysql_mutex.h:44
char start_plugin_dir[FN_REFLEN+1]
Stores the autentication plugin directory specified when running START SLAVE.
Definition: rpl_mi.h:133
bool reset
Definition: rpl_mi.h:624
virtual const char * get_for_channel_str(bool upper_case=false) const
Definition: rpl_mi.h:514
uint port
Definition: rpl_mi.h:288
Log info(cout, "NOTE")
Definition: mysql.h:294
char master_uuid[UUID_LENGTH+1]
Definition: rpl_mi.h:316
void finished_queueing()
When the receiver thread finishes queueing a transaction, that timestamp is recorded and the informat...
Definition: rpl_mi.h:370
const Gtid * get_queueing_trx_gtid()
Definition: rpl_mi.h:383
#define CHANNEL_NAME_LENGTH
Definition: rpl_info.h:40
This has the functionality of mysql_rwlock_t, with two differences:
Definition: rpl_gtid.h:429
enum_binlog_checksum_alg
Enumeration spcifying checksum algorithm used to encode a binary log event.
Definition: binlog_event.h:398
const int MAX_PASSWORD_LENGTH
Definition: validate_password_imp.cc:42
bool write_info(Rpl_info_handler *to)
Definition: rpl_mi.cc:597
char ssl_ca[FN_REFLEN]
Definition: rpl_mi.h:278
static bool is_configured(Master_info *mi)
Definition: rpl_mi.h:102
bool auto_position
Definition: rpl_mi.h:525
bool is_start_plugin_auth_configured() const
Returns if DEFAULT_AUTH was specified when running START SLAVE.
Definition: rpl_mi.h:178
float heartbeat_period
Definition: rpl_mi.h:301
bool is_set_network_namespace() const
Definition: rpl_mi.h:325
unsigned long ulong
Definition: my_inttypes.h:48
bool get_password(char *password_arg, size_t *password_arg_size)
Returns either user&#39;s password in the master.info repository or user&#39;s password used in START SLAVE...
Definition: rpl_mi.cc:640
PSI_mutex_key * key_info_rotate_lock
PSI key for the rotate_lock
Definition: rpl_mi.h:142
void channel_assert_some_wrlock() const
Assert that some thread holds the write lock.
Definition: rpl_mi.h:598
ulong retry_count
Definition: rpl_mi.h:315
void clear_processing_trx()
Clear only the processing_trx monitoring info.
Definition: rpl_gtid_misc.cc:461
char public_key_path[FN_REFLEN]
Definition: rpl_mi.h:281
void get_flushed_relay_log_info(LOG_INFO *linfo)
Collect relay log coordinates (file name and position) that related to the last Master_info master co...
Definition: rpl_mi.cc:702
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:777
bool read_info(Rpl_info_handler *from)
Definition: rpl_mi.cc:431