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