MySQL  8.0.16
Source Code Documentation
rpl_slave.h
Go to the documentation of this file.
1 /* Copyright (c) 2000, 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_SLAVE_H
24 #define RPL_SLAVE_H
25 
26 #include <limits.h>
27 #include <sys/types.h>
28 #include <atomic>
29 
30 #include "m_string.h"
31 #include "my_bitmap.h"
32 #include "my_dbug.h"
33 #include "my_inttypes.h"
34 #include "my_psi_config.h"
35 #include "my_thread.h" // my_start_routine
37 #include "mysql_com.h"
38 #include "sql/current_thd.h"
39 #include "sql/debug_sync.h"
40 
41 class Master_info;
42 class Relay_log_info;
43 class THD;
44 struct LEX_MASTER_INFO;
45 struct mysql_cond_t;
46 struct mysql_mutex_t;
47 
49 
51 
52 /**
53  MASTER_DELAY can be at most (1 << 31) - 1.
54 */
55 #define MASTER_DELAY_MAX (0x7FFFFFFF)
56 #if INT_MAX < 0x7FFFFFFF
57 #error "don't support platforms where INT_MAX < 0x7FFFFFFF"
58 #endif
59 
60 /**
61  @defgroup Replication Replication
62  @{
63 
64  @file
65 */
66 
67 /**
68  Some of defines are need in parser even though replication is not
69  compiled in (embedded).
70 */
71 
72 /**
73  The maximum is defined as (ULONG_MAX/1000) with 4 bytes ulong
74 */
75 #define SLAVE_MAX_HEARTBEAT_PERIOD 4294967
76 
77 #define SLAVE_NET_TIMEOUT 60
78 
79 #define MAX_SLAVE_ERROR 14000
80 
81 #define MTS_WORKER_UNDEF ((ulong)-1)
82 #define MTS_MAX_WORKERS 1024
83 #define MAX_SLAVE_RETRY_PAUSE 5
84 
85 /*
86  When using tables to store the slave workers bitmaps,
87  we use a BLOB field. The maximum size of a BLOB is:
88 
89  2^16-1 = 65535 bytes => (2^16-1) * 8 = 524280 bits
90 */
91 #define MTS_MAX_BITS_IN_GROUP ((1L << 19) - 8) /* 524280 */
92 
93 extern bool server_id_supplied;
94 
95 /*****************************************************************************
96 
97  MySQL Replication
98 
99  Replication is implemented via two types of threads:
100 
101  I/O Thread - One of these threads is started for each master server.
102  They maintain a connection to their master server, read log
103  events from the master as they arrive, and queues them into
104  a single, shared relay log file. A Master_info represents
105  each of these threads.
106 
107  SQL Thread - One of these threads is started and reads from the relay log
108  file, executing each event. A Relay_log_info represents this
109  thread.
110 
111  Buffering in the relay log file makes it unnecessary to reread events from
112  a master server across a slave restart. It also decouples the slave from
113  the master where long-running updates and event logging are concerned--ie
114  it can continue to log new events while a slow query executes on the slave.
115 
116 *****************************************************************************/
117 
118 /*
119  # MUTEXES in replication #
120 
121  JAG: TODO: This guide needs to be updated after pushing WL#10406!
122 
123  ## In Multisource_info (channel_map) ##
124 
125  ### m_channel_map_lock ###
126 
127  This rwlock is used to protect the multi source replication data structure
128  (channel_map). Any operation reading contents from the channel_map should
129  hold the rdlock during the operation. Any operation changing the
130  channel_map (either adding/removing channels to/from the channel_map)
131  should hold the wrlock during the operation.
132 
133  [init_slave() does not need it it's called early].
134 
135  ## In Master_info (mi) ##
136 
137  ### m_channel_lock ###
138 
139  It is used to SERIALIZE ALL administrative commands of replication: START
140  SLAVE, STOP SLAVE, CHANGE MASTER, RESET SLAVE, delete_slave_info_objects
141  (when mysqld stops)
142 
143  This thus protects us against a handful of deadlocks, being the know ones
144  around lock_slave_threads and the mixed order they are acquired in some
145  operations:
146 
147  + consider start_slave_thread() which, when starting the I/O thread,
148  releases mi->run_lock, keeps rli->run_lock, and tries to re-acquire
149  mi->run_lock.
150 
151  + Same applies to stop_slave() where a stop of the I/O thread will
152  mi->run_lock, keeps rli->run_lock, and tries to re-acquire mi->run_lock.
153  For the SQL thread, the order is the opposite.
154 
155  ### run_lock ###
156 
157  Protects all information about the running state: slave_running, thd
158  and the existence of the I/O thread itself (to stop/start it, you need
159  this mutex).
160  Check the above m_channel_lock about locking order.
161 
162  ### data_lock ###
163 
164  Protects some moving members of the struct: counters (log name,
165  position).
166 
167  ### sid_lock ###
168 
169  Protects the retrieved GTID set and it's SID map from updates.
170 
171  ## In Relay_log_info (rli) ##
172 
173  ### run_lock ###
174 
175  Same as Master_info's one. However, note that run_lock does not protect
176  Relay_log_info.run_state. That is protected by data_lock.
177  Check the above m_channel_lock about locking order.
178 
179  ### data_lock ###
180 
181  Protects some moving members of the struct: counters (log name,
182  position).
183 
184  ## In MYSQL_BIN_LOG (mysql_bin_log,relay_log) ##
185 
186  ### LOCK_log ###
187 
188  This mutex should be taken when going to write to a log file. Notice that it
189  does not prevent other threads from reading from the file being written (the
190  "hot" file) or any other older file.
191 
192  ### LOCK_index ###
193 
194  This mutex should be taken when going to create/delete a log file (as those
195  operations will update the .index file).
196 
197  ### LOCK_binlog_end_pos ###
198 
199  This mutex protects the access to the binlog_end_pos variable. The variable
200  it set with the position that other threads reading from the currently active
201  log file (the "hot" one) should not cross.
202 
203  ## Gtid_state (gtid_state, global_sid_map) ##
204 
205  ### global_sid_lock ###
206 
207  Protects all Gtid_state GTID sets (lost_gtids, executed_gtids,
208  gtids_only_in_table, previous_gtids_logged, owned_gtids) and the global SID
209  map from updates.
210 
211  The global_sid_lock must not be taken after LOCK_reset_gtid_table.
212 
213  ## Gtid_mode (gtid_mode) ##
214 
215  ### gtid_mode_lock ###
216 
217  Used to arbitrate changes on server Gtid_mode.
218 
219  # Order of acquisition #
220 
221  Here, we list most major functions that acquire multiple locks.
222 
223  Notation: For each function, we list the locks it takes, in the
224  order it takes them. If a function holds lock A while taking lock
225  B, then we write "A, B". If a function locks A, unlocks A, then
226  locks B, then we write "A | B". If function F1 invokes function F2,
227  then we write F2's name in parentheses in the list of locks for F1.
228 
229  Sys_var_gtid_mode::global_update:
230  gtid_mode_lock->wrlock, channel_map->wrlock, binlog.LOCK_log,
231  global_sid_lock->wrlock
232 
233  change_master_cmd:
234  channel_map.wrlock, (change_master)
235 
236  change_master:
237  mi.channel_wrlock, mi.run_lock, rli.run_lock, (global_init_info),
238  (purge_relay_logs), (init_relay_log_pos), rli.err_lock
239 
240  global_init_info:
241  mi.data_lock, rli.data_lock
242 
243  purge_relay_logs:
244  rli.data_lock, (relay_log.reset_logs)
245 
246  relay_log.reset_logs:
247  .LOCK_log, .LOCK_index, .sid_lock->wrlock
248 
249  init_relay_log_pos:
250  rli.data_lock
251 
252  queue_event:
253  rli.LOCK_log, relay_log.sid_lock->rdlock, mi.data_lock
254 
255  stop_slave:
256  channel_map rdlock,
257  ( mi.channel_wrlock, mi.run_lock, thd.LOCK_thd_data
258  | rli.run_lock, thd.LOCK_thd_data
259  | relay.LOCK_log
260  )
261 
262  start_slave:
263  mi.channel_wrlock, mi.run_lock, rli.run_lock, rli.data_lock,
264  global_sid_lock->wrlock
265 
266  mysql_bin_log.reset_logs:
267  .LOCK_log, .LOCK_index, global_sid_lock->wrlock
268 
269  purge_relay_logs:
270  rli.data_lock, (relay.reset_logs) THD::LOCK_thd_data,
271  relay.LOCK_log, relay.LOCK_index, global_sid_lock->wrlock
272 
273  reset_master:
274  (binlog.reset_logs) THD::LOCK_thd_data, binlog.LOCK_log,
275  binlog.LOCK_index, global_sid_lock->wrlock, LOCK_reset_gtid_table
276 
277  reset_slave:
278  mi.channel_wrlock, mi.run_lock, rli.run_lock, (purge_relay_logs)
279  rli.data_lock, THD::LOCK_thd_data, relay.LOCK_log, relay.LOCK_index,
280  global_sid_lock->wrlock
281 
282  purge_logs:
283  .LOCK_index, LOCK_thd_list, thd.linfo.lock
284 
285  [Note: purge_logs contains a known bug: LOCK_index should not be
286  taken before LOCK_thd_list. This implies that, e.g.,
287  purge_master_logs can deadlock with reset_master. However,
288  although purge_first_log and reset_slave take locks in reverse
289  order, they cannot deadlock because they both first acquire
290  rli.data_lock.]
291 
292  purge_master_logs, purge_master_logs_before_date, purge:
293  (binlog.purge_logs) binlog.LOCK_index, LOCK_thd_list, thd.linfo.lock
294 
295  purge_first_log:
296  rli.data_lock, relay.LOCK_index, rli.log_space_lock,
297  (relay.purge_logs) LOCK_thd_list, thd.linfo.lock
298 
299  MYSQL_BIN_LOG::new_file_impl:
300  .LOCK_log, .LOCK_index,
301  ( [ if binlog: LOCK_prep_xids ]
302  | global_sid_lock->wrlock
303  )
304 
305  rotate_relay_log:
306  (relay.new_file_impl) relay.LOCK_log, relay.LOCK_index
307 
308  kill_zombie_dump_threads:
309  LOCK_thd_list, thd.LOCK_thd_data
310 
311  rli_init_info:
312  rli.data_lock,
313  ( relay.log_lock
314  | global_sid_lock->wrlock
315  | (relay.open_binlog)
316  | (init_relay_log_pos) rli.data_lock, relay.log_lock
317  )
318 
319  So the DAG of lock acquisition order (not counting the buggy
320  purge_logs) is, empirically:
321 
322  gtid_mode_lock, channel_map lock, mi.run_lock, rli.run_lock,
323  ( rli.data_lock,
324  ( LOCK_thd_list,
325  (
326  ( binlog.LOCK_log, binlog.LOCK_index
327  | relay.LOCK_log, relay.LOCK_index
328  ),
329  ( rli.log_space_lock | global_sid_lock->wrlock )
330  | binlog.LOCK_log, binlog.LOCK_index, LOCK_prep_xids
331  | thd.LOCK_data
332  )
333  | mi.err_lock, rli.err_lock
334  )
335  )
336  )
337  | mi.data_lock, rli.data_lock
338 */
339 
342 extern char slave_skip_error_names[];
343 extern bool use_slave_mask;
344 extern char *slave_load_tmpdir;
348 extern bool opt_relay_logname_supplied;
349 extern char *opt_binlog_index_name;
350 extern bool opt_skip_slave_start;
351 extern bool opt_log_slave_updates;
352 extern char *opt_slave_skip_errors;
354 
355 extern const char *relay_log_index;
356 extern const char *relay_log_basename;
357 
358 /*
359  3 possible values for Master_info::slave_running and
360  Relay_log_info::slave_running.
361  The values 0,1,2 are very important: to keep the diff small, I didn't
362  substitute places where we use 0/1 with the newly defined symbols. So don't
363  change these values. The same way, code is assuming that in Relay_log_info we
364  use only values 0/1. I started with using an enum, but enum_variable=1; is not
365  legal so would have required many line changes.
366 */
367 #define MYSQL_SLAVE_NOT_RUN 0
368 #define MYSQL_SLAVE_RUN_NOT_CONNECT 1
369 #define MYSQL_SLAVE_RUN_CONNECT 2
370 
371 /*
372  If the following is set, if first gives an error, second will be
373  tried. Otherwise, if first fails, we fail.
374 */
375 #define SLAVE_FORCE_ALL 4
376 
377 /* @todo: see if you can change to int */
378 bool start_slave_cmd(THD *thd);
379 bool stop_slave_cmd(THD *thd);
380 bool change_master_cmd(THD *thd);
381 int change_master(THD *thd, Master_info *mi, LEX_MASTER_INFO *lex_mi,
382  bool preserve_logs = false);
383 bool reset_slave_cmd(THD *thd);
384 bool show_slave_status_cmd(THD *thd);
385 bool flush_relay_logs_cmd(THD *thd);
386 /**
387  Re-encrypt previous relay logs with current master key for all slave channels.
388 
389  @retval false Success.
390  @retval true Error.
391 */
392 bool reencrypt_relay_logs();
393 int flush_relay_logs(Master_info *mi, THD *thd);
394 int reset_slave(THD *thd, Master_info *mi, bool reset_all);
395 int reset_slave(THD *thd);
396 int init_slave();
397 int init_recovery(Master_info *mi);
398 /**
399  Call mi->init_info() and/or mi->rli->init_info(), which will read
400  the replication configuration from repositories.
401 
402  This takes care of creating a transaction context in case table
403  repository is needed.
404 
405  @param mi The Master_info object to use.
406 
407  @param ignore_if_no_info If this is false, and the repository does
408  not exist, it will be created. If this is true, and the repository
409  does not exist, nothing is done.
410 
411  @param thread_mask Indicate which repositories will be initialized:
412  if (thread_mask&SLAVE_IO)!=0, then mi->init_info is called; if
413  (thread_mask&SLAVE_SQL)!=0, then mi->rli->init_info is called.
414 
415  @param skip_received_gtid_set_recovery When true, skips the received GTID
416  set recovery.
417 
418  @retval 0 Success
419  @retval nonzero Error
420 */
422  Master_info *mi, bool ignore_if_no_info, int thread_mask,
423  bool skip_received_gtid_set_recovery = false);
424 void end_info(Master_info *mi);
425 int remove_info(Master_info *mi);
426 int flush_master_info(Master_info *mi, bool force, bool need_lock = true,
427  bool flush_relay_log = true);
428 void add_slave_skip_errors(const char *arg);
429 void set_slave_skip_errors(char **slave_skip_errors_ptr);
430 int add_new_channel(Master_info **mi, const char *channel);
431 /**
432  Terminates the slave threads according to the given mask.
433 
434  @param mi the master info repository
435  @param thread_mask the mask identifying which thread(s) to terminate
436  @param stop_wait_timeout the timeout after which the method returns and error
437  @param need_lock_term
438  If @c false the lock will not be acquired before waiting on
439  the condition. In this case, it is assumed that the calling
440  function acquires the lock before calling this function.
441 
442  @return the operation status
443  @retval 0 OK
444  @retval ER_SLAVE_NOT_RUNNING
445  The slave is already stopped
446  @retval ER_STOP_SLAVE_SQL_THREAD_TIMEOUT
447  There was a timeout when stopping the SQL thread
448  @retval ER_STOP_SLAVE_IO_THREAD_TIMEOUT
449  There was a timeout when stopping the IO thread
450  @retval ER_ERROR_DURING_FLUSH_LOGS
451  There was an error while flushing the log/repositories
452 */
453 int terminate_slave_threads(Master_info *mi, int thread_mask,
454  ulong stop_wait_timeout,
455  bool need_lock_term = true);
456 bool start_slave_threads(bool need_lock_slave, bool wait_for_start,
457  Master_info *mi, int thread_mask);
458 bool start_slave(THD *thd);
459 int stop_slave(THD *thd);
460 bool start_slave(THD *thd, LEX_SLAVE_CONNECTION *connection_param,
461  LEX_MASTER_INFO *master_param, int thread_mask_input,
462  Master_info *mi, bool set_mts_settings);
463 int stop_slave(THD *thd, Master_info *mi, bool net_report, bool for_one_channel,
464  bool *push_temp_table_warning);
465 /*
466  cond_lock is usually same as start_lock. It is needed for the case when
467  start_lock is 0 which happens if start_slave_thread() is called already
468  inside the start_lock section, but at the same time we want a
469  mysql_cond_wait() on start_cond, start_lock
470 */
471 bool start_slave_thread(
473  PSI_thread_key thread_key,
474 #endif
475  my_start_routine h_func, mysql_mutex_t *start_lock,
476  mysql_mutex_t *cond_lock, mysql_cond_t *start_cond,
477  std::atomic<uint> *slave_running, std::atomic<ulong> *slave_run_id,
478  Master_info *mi);
479 
480 bool show_slave_status(THD *thd, Master_info *mi);
481 bool show_slave_status(THD *thd);
482 bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report,
483  bool (*pred)(const void *), const void *param);
485 
486 const char *print_slave_db_safe(const char *db);
487 
488 void end_slave(); /* release slave threads */
489 void delete_slave_info_objects(); /* clean up slave threads data */
490 /**
491  This method locks both (in this order)
492  mi->run_lock
493  rli->run_lock
494 
495  @param mi The associated master info object
496 
497  @note this method shall be invoked while locking mi->m_channel_lock
498  for writes. This is due to the mixed order in which these locks are released
499  and acquired in such method as the slave threads start and stop methods.
500 */
503 void init_thread_mask(int *mask, Master_info *mi, bool inverse);
504 void set_slave_thread_options(THD *thd);
506 int rotate_relay_log(Master_info *mi, bool log_master_fd = true,
507  bool need_lock = true, bool need_log_space_lock = true);
508 typedef enum {
513 QUEUE_EVENT_RESULT queue_event(Master_info *mi, const char *buf,
514  ulong event_len, bool flush_mi = true);
515 
516 extern "C" void *handle_slave_io(void *arg);
517 extern "C" void *handle_slave_sql(void *arg);
518 bool net_request_file(NET *net, const char *fname);
519 
520 extern bool replicate_same_server_id;
521 
523 
524 /* the master variables are defaults read from my.cnf or command line */
525 extern uint report_port;
527 extern char *report_host, *report_password;
528 
530 /**
531  Processing rli->gaq to find out the low-water-mark (lwm) coordinates
532  which is stored into the central recovery table. rli->data_lock will be
533  required, so the caller should not hold rli->data_lock.
534 
535  @param rli pointer to Relay-log-info of Coordinator
536  @param force if true then hang in a loop till some progress
537  @retval false Success
538  @retval true Error
539 */
540 bool mts_checkpoint_routine(Relay_log_info *rli, bool force);
541 bool sql_slave_killed(THD *thd, Relay_log_info *rli);
542 
543 /* masks for start/stop operations on io and sql slave threads */
544 #define SLAVE_IO 1
545 #define SLAVE_SQL 2
546 
547 /**
548  @} (end of group Replication)
549 */
550 #endif
void unlock_slave_threads(Master_info *mi)
Definition: rpl_slave.cc:400
unsigned long long int ulonglong
Definition: my_inttypes.h:69
bool net_request_file(NET *net, const char *fname)
Definition: rpl_slave.cc:2170
Structure to hold parameters for CHANGE MASTER, START SLAVE, and STOP SLAVE.
Definition: sql_lex.h:377
void end_info(Master_info *mi)
Definition: rpl_slave.cc:1261
bool rpl_master_erroneous_autoinc(THD *thd)
BUG#33029, For all 5.0 up to 5.0.58 exclusive, and 5.1 up to 5.1.12 exclusive, if one statement in a ...
Definition: rpl_slave.cc:8343
int disconnect_slave_event_count
Definition: rpl_slave.cc:223
void * handle_slave_sql(void *arg)
Slave SQL thread entry point.
Definition: rpl_slave.cc:6656
bool opt_relay_logname_supplied
Definition: mysqld.cc:1370
bool start_slave_threads(bool need_lock_slave, bool wait_for_start, Master_info *mi, int thread_mask)
Definition: rpl_slave.cc:1867
static mi_bit_type mask[]
Definition: mi_packrec.cc:138
An instrumented cond structure.
Definition: mysql_cond_bits.h:49
void lock_slave_threads(Master_info *mi)
This method locks both (in this order) mi->run_lock rli->run_lock.
Definition: rpl_slave.cc:384
Definition: sql_lex.h:2461
void * handle_slave_io(void *arg)
Slave IO thread entry point.
Definition: rpl_slave.cc:5088
Some integer typedefs for easier portability.
Definition: rpl_slave.h:50
void set_slave_skip_errors(char **slave_skip_errors_ptr)
Change arg to the string with the nice, human-readable skip error values.
Definition: rpl_slave.cc:1417
char * opt_relaylog_index_name
Definition: mysqld.cc:1360
bool sql_slave_killed(THD *thd, Relay_log_info *rli)
The function analyzes a possible killed status and makes a decision whether to accept it or not...
Definition: rpl_slave.cc:2064
bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report, bool(*pred)(const void *), const void *param)
Detects, based on master&#39;s version (as found in the relay log), if master has a certain bug...
Definition: rpl_slave.cc:8260
int init_slave()
Definition: rpl_slave.cc:441
bool mts_recovery_groups(Relay_log_info *rli)
Definition: rpl_slave.cc:5873
const char * relay_log_basename
Definition: rpl_slave.cc:177
Definition: rpl_slave.h:50
SLAVE_THD_TYPE
Definition: rpl_slave.h:50
const char * print_slave_db_safe(const char *db)
Definition: rpl_slave.cc:2183
bool reencrypt_relay_logs()
Re-encrypt previous relay logs with current master key for all slave channels.
Definition: rpl_slave.cc:8218
Definition: rpl_slave.h:511
int rotate_relay_log(Master_info *mi, bool log_master_fd, bool need_lock, bool need_log_space_lock)
Definition: rpl_slave.cc:8043
int flush_master_info(Master_info *mi, bool force, bool need_lock, bool do_flush_relay_log)
Definition: rpl_slave.cc:1310
void set_slave_thread_default_charset(THD *thd, Relay_log_info const *rli)
Definition: rpl_slave.cc:3809
bool opt_relaylog_index_name_supplied
Definition: mysqld.cc:1365
ulong master_retry_count
Definition: mysqld.cc:1357
bool flush_relay_logs_cmd(THD *thd)
Entry point for FLUSH RELAYLOGS command or to flush relaylogs for the FLUSH LOGS command.
Definition: rpl_slave.cc:8151
char * slave_load_tmpdir
Definition: rpl_slave.cc:172
Common definition between mysql server & client.
int init_recovery(Master_info *mi)
Definition: rpl_slave.cc:1044
bool stop_slave_cmd(THD *thd)
Entry point for the STOP SLAVE command.
Definition: rpl_slave.cc:758
char * opt_relay_logname
Definition: mysqld.cc:1360
char * report_host
Definition: mysqld.cc:1359
constexpr inverse_alphabet_type inverse(const alphabet_type &v)
inverse
Definition: base64.h:396
void *(* my_start_routine)(void *)
Definition: my_thread.h:81
uint report_port
Definition: mysqld.cc:1356
bool use_slave_mask
Definition: rpl_slave.cc:168
Definition: rpl_rli.h:164
Performance schema instrumentation interface.
bool start_slave_cmd(THD *thd)
Entry point to the START SLAVE command.
Definition: rpl_slave.cc:677
int change_master(THD *thd, Master_info *mi, LEX_MASTER_INFO *lex_mi, bool preserve_logs)
Execute a CHANGE MASTER statement.
Definition: rpl_slave.cc:9262
MY_BITMAP slave_error_mask
Definition: rpl_slave.cc:169
Definition: my_bitmap.h:42
int load_mi_and_rli_from_repositories(Master_info *mi, bool ignore_if_no_info, int thread_mask, bool skip_received_gtid_set_recovery)
Call mi->init_info() and/or mi->rli->init_info(), which will read the replication configuration from ...
Definition: rpl_slave.cc:1167
bool change_master_cmd(THD *thd)
Entry point for the CHANGE MASTER command.
Definition: rpl_slave.cc:9760
int stop_slave(THD *thd)
Function to stop a slave for all channels.
Definition: rpl_slave.cc:629
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
unsigned int uint
Definition: uca-dump.cc:29
bool replicate_same_server_id
Definition: rpl_slave.cc:173
void set_slave_thread_options(THD *thd)
Set slave thread default options.
Definition: rpl_slave.cc:3764
char * report_password
Definition: mysqld.cc:1359
bool server_id_supplied
Definition: mysqld.cc:960
bool reset_slave_cmd(THD *thd)
Entry function for RESET SLAVE command.
Definition: rpl_slave.cc:8863
char * opt_slave_skip_errors
Definition: mysqld.cc:1002
ulonglong relay_log_space_limit
Definition: rpl_slave.cc:174
void delete_slave_info_objects()
Free all resources used by slave threads at time of executing shutdown.
Definition: rpl_slave.cc:1979
char * relay_log_info_file
Definition: rpl_slave.h:526
char * report_user
Definition: mysqld.cc:1359
Definition: rpl_slave.h:509
Defines to make different thread packages compatible.
bool opt_skip_slave_start
If set, slave is not autostarted.
Definition: mysqld.cc:996
void end_slave()
Definition: rpl_slave.cc:1947
int abort_slave_event_count
Definition: rpl_slave.cc:223
int reset_slave(THD *thd)
Execute a RESET SLAVE (for all channels), used in Multisource replication.
Definition: rpl_slave.cc:8660
Definition: rpl_mi.h:85
unsigned int PSI_thread_key
Instrumented thread key.
Definition: psi_thread_bits.h:48
Declarations for the Debug Sync Facility.
bool mts_checkpoint_routine(Relay_log_info *rli, bool force)
Processing rli->gaq to find out the low-water-mark (lwm) coordinates which is stored into the central...
Definition: rpl_slave.cc:6126
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:49
void add_slave_skip_errors(const char *arg)
Definition: rpl_slave.cc:1469
int add_new_channel(Master_info **mi, const char *channel)
This function is first called when the Master_info object corresponding to a channel in a multisource...
Definition: rpl_slave.cc:9651
char * opt_binlog_index_name
Definition: mysqld.cc:1395
void init_thread_mask(int *mask, Master_info *mi, bool inverse)
Definition: rpl_slave.cc:368
int remove_info(Master_info *mi)
Definition: rpl_slave.cc:1275
QUEUE_EVENT_RESULT
Definition: rpl_slave.h:508
bool opt_log_slave_updates
Definition: mysqld.cc:1001
const char * relay_log_index
Definition: rpl_slave.cc:176
QUEUE_EVENT_RESULT queue_event(Master_info *mi, const char *buf, ulong event_len, bool do_flush_mi)
Store an event received from the master connection into the relay log.
Definition: rpl_slave.cc:7115
bool start_slave(THD *thd)
Function to start a slave for all channels.
Definition: rpl_slave.cc:566
bool show_slave_status_cmd(THD *thd)
Entry point for SHOW SLAVE STATUS command.
Definition: rpl_slave.cc:3719
#define HAVE_PSI_THREAD_INTERFACE
Definition: my_psi_config.h:111
bool show_slave_status(THD *thd)
Method to the show the replication status in all channels.
Definition: rpl_slave.cc:3522
int flush_relay_logs(Master_info *mi, THD *thd)
flushes the relay logs of a replication channel.
Definition: rpl_slave.cc:8105
unsigned long ulong
Definition: my_inttypes.h:46
char slave_skip_error_names[]
Definition: rpl_slave.cc:170
int terminate_slave_threads(Master_info *mi, int thread_mask, ulong stop_wait_timeout, bool need_lock_term)
Terminates the slave threads according to the given mask.
Definition: rpl_slave.cc:1541
Definition: mysql_com.h:838
Definition: rpl_slave.h:510
Definition: rpl_slave.h:50
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:776
char * master_info_file
Definition: rpl_slave.h:526
bool start_slave_thread(PSI_thread_key thread_key, my_start_routine h_func, mysql_mutex_t *start_lock, mysql_mutex_t *cond_lock, mysql_cond_t *start_cond, std::atomic< uint > *slave_running, std::atomic< ulong > *slave_run_id, Master_info *mi)
Definition: rpl_slave.cc:1788