MySQL  8.0.17
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;
345 extern const char *master_info_file;
346 extern const char *relay_log_info_file;
349 extern bool opt_relay_logname_supplied;
350 extern char *opt_binlog_index_name;
351 extern bool opt_skip_slave_start;
352 extern bool opt_log_slave_updates;
353 extern char *opt_slave_skip_errors;
355 
356 extern const char *relay_log_index;
357 extern const char *relay_log_basename;
358 
359 /*
360  3 possible values for Master_info::slave_running and
361  Relay_log_info::slave_running.
362  The values 0,1,2 are very important: to keep the diff small, I didn't
363  substitute places where we use 0/1 with the newly defined symbols. So don't
364  change these values. The same way, code is assuming that in Relay_log_info we
365  use only values 0/1. I started with using an enum, but enum_variable=1; is not
366  legal so would have required many line changes.
367 */
368 #define MYSQL_SLAVE_NOT_RUN 0
369 #define MYSQL_SLAVE_RUN_NOT_CONNECT 1
370 #define MYSQL_SLAVE_RUN_CONNECT 2
371 
372 /*
373  If the following is set, if first gives an error, second will be
374  tried. Otherwise, if first fails, we fail.
375 */
376 #define SLAVE_FORCE_ALL 4
377 
378 /* @todo: see if you can change to int */
379 bool start_slave_cmd(THD *thd);
380 bool stop_slave_cmd(THD *thd);
381 bool change_master_cmd(THD *thd);
382 int change_master(THD *thd, Master_info *mi, LEX_MASTER_INFO *lex_mi,
383  bool preserve_logs = false);
384 bool reset_slave_cmd(THD *thd);
385 bool show_slave_status_cmd(THD *thd);
386 bool flush_relay_logs_cmd(THD *thd);
387 /**
388  Re-encrypt previous relay logs with current master key for all slave channels.
389 
390  @retval false Success.
391  @retval true Error.
392 */
393 bool reencrypt_relay_logs();
394 int flush_relay_logs(Master_info *mi, THD *thd);
395 int reset_slave(THD *thd, Master_info *mi, bool reset_all);
396 int reset_slave(THD *thd);
397 int init_slave();
398 int init_recovery(Master_info *mi);
399 /**
400  Call mi->init_info() and/or mi->rli->init_info(), which will read
401  the replication configuration from repositories.
402 
403  This takes care of creating a transaction context in case table
404  repository is needed.
405 
406  @param mi The Master_info object to use.
407 
408  @param ignore_if_no_info If this is false, and the repository does
409  not exist, it will be created. If this is true, and the repository
410  does not exist, nothing is done.
411 
412  @param thread_mask Indicate which repositories will be initialized:
413  if (thread_mask&SLAVE_IO)!=0, then mi->init_info is called; if
414  (thread_mask&SLAVE_SQL)!=0, then mi->rli->init_info is called.
415 
416  @param skip_received_gtid_set_recovery When true, skips the received GTID
417  set recovery.
418 
419  @retval 0 Success
420  @retval nonzero Error
421 */
423  Master_info *mi, bool ignore_if_no_info, int thread_mask,
424  bool skip_received_gtid_set_recovery = false);
425 void end_info(Master_info *mi);
426 int remove_info(Master_info *mi);
427 int flush_master_info(Master_info *mi, bool force, bool need_lock = true,
428  bool flush_relay_log = true);
429 void add_slave_skip_errors(const char *arg);
430 void set_slave_skip_errors(char **slave_skip_errors_ptr);
431 int add_new_channel(Master_info **mi, const char *channel);
432 /**
433  Terminates the slave threads according to the given mask.
434 
435  @param mi the master info repository
436  @param thread_mask the mask identifying which thread(s) to terminate
437  @param stop_wait_timeout the timeout after which the method returns and error
438  @param need_lock_term
439  If @c false the lock will not be acquired before waiting on
440  the condition. In this case, it is assumed that the calling
441  function acquires the lock before calling this function.
442 
443  @return the operation status
444  @retval 0 OK
445  @retval ER_SLAVE_NOT_RUNNING
446  The slave is already stopped
447  @retval ER_STOP_SLAVE_SQL_THREAD_TIMEOUT
448  There was a timeout when stopping the SQL thread
449  @retval ER_STOP_SLAVE_IO_THREAD_TIMEOUT
450  There was a timeout when stopping the IO thread
451  @retval ER_ERROR_DURING_FLUSH_LOGS
452  There was an error while flushing the log/repositories
453 */
454 int terminate_slave_threads(Master_info *mi, int thread_mask,
455  ulong stop_wait_timeout,
456  bool need_lock_term = true);
457 bool start_slave_threads(bool need_lock_slave, bool wait_for_start,
458  Master_info *mi, int thread_mask);
459 bool start_slave(THD *thd);
460 int stop_slave(THD *thd);
461 bool start_slave(THD *thd, LEX_SLAVE_CONNECTION *connection_param,
462  LEX_MASTER_INFO *master_param, int thread_mask_input,
463  Master_info *mi, bool set_mts_settings);
464 int stop_slave(THD *thd, Master_info *mi, bool net_report, bool for_one_channel,
465  bool *push_temp_table_warning);
466 /*
467  cond_lock is usually same as start_lock. It is needed for the case when
468  start_lock is 0 which happens if start_slave_thread() is called already
469  inside the start_lock section, but at the same time we want a
470  mysql_cond_wait() on start_cond, start_lock
471 */
472 bool start_slave_thread(
474  PSI_thread_key thread_key,
475 #endif
476  my_start_routine h_func, mysql_mutex_t *start_lock,
477  mysql_mutex_t *cond_lock, mysql_cond_t *start_cond,
478  std::atomic<uint> *slave_running, std::atomic<ulong> *slave_run_id,
479  Master_info *mi);
480 
481 bool show_slave_status(THD *thd, Master_info *mi);
482 bool show_slave_status(THD *thd);
483 bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report,
484  bool (*pred)(const void *), const void *param);
486 
487 const char *print_slave_db_safe(const char *db);
488 
489 void end_slave(); /* release slave threads */
490 void delete_slave_info_objects(); /* clean up slave threads data */
491 /**
492  This method locks both (in this order)
493  mi->run_lock
494  rli->run_lock
495 
496  @param mi The associated master info object
497 
498  @note this method shall be invoked while locking mi->m_channel_lock
499  for writes. This is due to the mixed order in which these locks are released
500  and acquired in such method as the slave threads start and stop methods.
501 */
504 void init_thread_mask(int *mask, Master_info *mi, bool inverse);
505 void set_slave_thread_options(THD *thd);
507 int rotate_relay_log(Master_info *mi, bool log_master_fd = true,
508  bool need_lock = true, bool need_log_space_lock = true);
509 typedef enum {
514 QUEUE_EVENT_RESULT queue_event(Master_info *mi, const char *buf,
515  ulong event_len, bool flush_mi = true);
516 
517 extern "C" void *handle_slave_io(void *arg);
518 extern "C" void *handle_slave_sql(void *arg);
519 bool net_request_file(NET *net, const char *fname);
520 
521 extern bool replicate_same_server_id;
522 
524 
525 /* the master variables are defaults read from my.cnf or command line */
526 extern uint report_port;
527 extern const char *master_info_file;
528 extern const char *relay_log_info_file;
529 extern char *report_user;
530 extern char *report_host, *report_password;
531 
533 /**
534  Processing rli->gaq to find out the low-water-mark (lwm) coordinates
535  which is stored into the central recovery table. rli->data_lock will be
536  required, so the caller should not hold rli->data_lock.
537 
538  @param rli pointer to Relay-log-info of Coordinator
539  @param force if true then hang in a loop till some progress
540  @retval false Success
541  @retval true Error
542 */
543 bool mts_checkpoint_routine(Relay_log_info *rli, bool force);
544 bool sql_slave_killed(THD *thd, Relay_log_info *rli);
545 
546 /* masks for start/stop operations on io and sql slave threads */
547 #define SLAVE_IO 1
548 #define SLAVE_SQL 2
549 
550 /**
551  @} (end of group Replication)
552 */
553 #endif
void unlock_slave_threads(Master_info *mi)
Definition: rpl_slave.cc:401
unsigned long long int ulonglong
Definition: my_inttypes.h:74
bool net_request_file(NET *net, const char *fname)
Definition: rpl_slave.cc:2189
Structure to hold parameters for CHANGE MASTER, START SLAVE, and STOP SLAVE.
Definition: sql_lex.h:304
void end_info(Master_info *mi)
Definition: rpl_slave.cc:1279
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:8366
int disconnect_slave_event_count
Definition: rpl_slave.cc:224
const char * master_info_file
Definition: rpl_slave.h:527
void * handle_slave_sql(void *arg)
Slave SQL thread entry point.
Definition: rpl_slave.cc:6681
bool opt_relay_logname_supplied
Definition: mysqld.cc:1415
bool start_slave_threads(bool need_lock_slave, bool wait_for_start, Master_info *mi, int thread_mask)
Definition: rpl_slave.cc:1886
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:385
Definition: sql_lex.h:1880
void * handle_slave_io(void *arg)
Slave IO thread entry point.
Definition: rpl_slave.cc:5110
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:1435
char * opt_relaylog_index_name
Definition: mysqld.cc:1405
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:2083
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:8288
int init_slave()
Definition: rpl_slave.cc:442
bool mts_recovery_groups(Relay_log_info *rli)
Definition: rpl_slave.cc:5897
const char * relay_log_basename
Definition: rpl_slave.cc:178
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:2203
bool reencrypt_relay_logs()
Re-encrypt previous relay logs with current master key for all slave channels.
Definition: rpl_slave.cc:8246
Definition: rpl_slave.h:512
int rotate_relay_log(Master_info *mi, bool log_master_fd, bool need_lock, bool need_log_space_lock)
Definition: rpl_slave.cc:8071
int flush_master_info(Master_info *mi, bool force, bool need_lock, bool do_flush_relay_log)
Definition: rpl_slave.cc:1328
void set_slave_thread_default_charset(THD *thd, Relay_log_info const *rli)
Definition: rpl_slave.cc:3831
bool opt_relaylog_index_name_supplied
Definition: mysqld.cc:1410
ulong master_retry_count
Definition: mysqld.cc:1401
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:8179
char * slave_load_tmpdir
Definition: rpl_slave.cc:173
Common definition between mysql server & client.
int init_recovery(Master_info *mi)
Definition: rpl_slave.cc:1062
bool stop_slave_cmd(THD *thd)
Entry point for the STOP SLAVE command.
Definition: rpl_slave.cc:759
char * opt_relay_logname
Definition: mysqld.cc:1405
char * report_host
Definition: mysqld.cc:1404
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:1400
bool use_slave_mask
Definition: rpl_slave.cc:169
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:678
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:9285
MY_BITMAP slave_error_mask
Definition: rpl_slave.cc:170
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:1185
bool change_master_cmd(THD *thd)
Entry point for the CHANGE MASTER command.
Definition: rpl_slave.cc:9783
int stop_slave(THD *thd)
Function to stop a slave for all channels.
Definition: rpl_slave.cc:630
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:174
void set_slave_thread_options(THD *thd)
Set slave thread default options.
Definition: rpl_slave.cc:3786
char * report_password
Definition: mysqld.cc:1404
bool server_id_supplied
Definition: mysqld.cc:995
bool reset_slave_cmd(THD *thd)
Entry function for RESET SLAVE command.
Definition: rpl_slave.cc:8886
char * opt_slave_skip_errors
Definition: mysqld.cc:1037
ulonglong relay_log_space_limit
Definition: rpl_slave.cc:175
void delete_slave_info_objects()
Free all resources used by slave threads at time of executing shutdown.
Definition: rpl_slave.cc:1998
Definition: rpl_slave.h:510
Defines to make different thread packages compatible.
bool opt_skip_slave_start
If set, slave is not autostarted.
Definition: mysqld.cc:1031
char * report_user
Definition: mysqld.cc:1404
void end_slave()
Definition: rpl_slave.cc:1966
int abort_slave_event_count
Definition: rpl_slave.cc:224
int reset_slave(THD *thd)
Execute a RESET SLAVE (for all channels), used in Multisource replication.
Definition: rpl_slave.cc:8683
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:6151
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:49
void add_slave_skip_errors(const char *arg)
Definition: rpl_slave.cc:1487
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:9674
const char * relay_log_info_file
Definition: rpl_slave.h:528
char * opt_binlog_index_name
Definition: mysqld.cc:1440
void init_thread_mask(int *mask, Master_info *mi, bool inverse)
Definition: rpl_slave.cc:369
int remove_info(Master_info *mi)
Definition: rpl_slave.cc:1293
QUEUE_EVENT_RESULT
Definition: rpl_slave.h:509
bool opt_log_slave_updates
Definition: mysqld.cc:1036
const char * relay_log_index
Definition: rpl_slave.cc:177
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:7140
bool start_slave(THD *thd)
Function to start a slave for all channels.
Definition: rpl_slave.cc:567
bool show_slave_status_cmd(THD *thd)
Entry point for SHOW SLAVE STATUS command.
Definition: rpl_slave.cc:3741
#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:3544
int flush_relay_logs(Master_info *mi, THD *thd)
flushes the relay logs of a replication channel.
Definition: rpl_slave.cc:8133
unsigned long ulong
Definition: my_inttypes.h:48
char slave_skip_error_names[]
Definition: rpl_slave.cc:171
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:1560
Definition: mysql_com.h:829
Definition: rpl_slave.h:511
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:777
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:1807