MySQL  8.0.16
Source Code Documentation
replication.h
Go to the documentation of this file.
1 /* Copyright (c) 2008, 2018, 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 REPLICATION_H
24 #define REPLICATION_H
25 
26 #include "my_thread_local.h" // my_thread_id
27 #include "mysql/psi/mysql_thread.h" // mysql_mutex_t
28 #include "rpl_context.h"
29 #include "sql/handler.h" // enum_tx_isolation
30 
31 struct MYSQL;
32 
33 #ifdef __cplusplus
34 class THD;
35 #define MYSQL_THD THD *
36 #else
37 #define MYSQL_THD void *
38 #endif
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /**
45  Struct to share server ssl variables
46 */
49  char *ssl_ca;
50  char *ssl_capath;
51  char *tls_version;
52  char *ssl_cert;
53  char *ssl_cipher;
54  char *ssl_key;
55  char *ssl_crl;
56  char *ssl_crlpath;
57  unsigned int ssl_fips_mode;
58 };
59 
60 /**
61  Transaction observer flags.
62 */
64  /** Transaction is a real transaction */
66 };
67 
68 /**
69  This represents table metadata involved in a transaction
70  */
71 typedef struct Trans_table_info {
72  const char *table_name;
74  /// The db_type of the storage engine used by the table
75  int db_type;
76  /// information to store if the table has foreign key with 'CASCADE' clause.
79 
80 /**
81  This represents some of the context in which a transaction is running
82  It summarizes all necessary requirements for Group Replication to work.
83 
84  These requirements might be extracted in two different moments in time, and,
85  as such, with different contexts:
86  - Startup verifications, that are extracted when Group Replication starts,
87  and typically from global vars.
88  - Runtime verifications, that are extracted when a transaction is running. It
89  it typically from session THD vars or from mutable global vars.
90 
91  Please refer to the place where information is extracted for more details
92  about it.
93  */
94 typedef struct Trans_context_info {
96  ulong gtid_mode; // enum values in enum_gtid_mode
98  ulong binlog_checksum_options; // enum values in enum
99  // enum_binlog_checksum_alg
100  ulong binlog_format; // enum values in enum enum_binlog_format
101  // enum values in enum_transaction_write_set_hashing_algorithm
103  ulong mi_repository_type; // enum values in enum_info_repository
104  ulong rli_repository_type; // enum values in enum_info_repository
105  // enum values in enum_mts_parallel_type
109  enum_tx_isolation tx_isolation; // enum values in enum_tx_isolation
113 
114 /**
115  This represents the GTID context of the transaction.
116  */
117 typedef struct Trans_gtid_info {
118  ulong type; // enum values in enum_gtid_type
119  int sidno; // transaction sidno
120  long long int gno; // transaction gno
122 
124 /**
125  Transaction observer parameter
126 */
127 typedef struct Trans_param {
128  uint32 server_id;
129  const char *server_uuid;
131  uint32 flags;
132 
133  /*
134  The latest binary log file name and position written by current
135  transaction, if binary log is disabled or no log event has been
136  written into binary log file by current transaction (events
137  written into transaction log cache are not counted), these two
138  member will be zero.
139  */
140  const char *log_file;
142 
143  /*
144  Transaction GTID information.
145  */
147 
148  /*
149  Set on before_commit hook.
150  */
154  /*
155  The flag designates the transaction is a DDL contained is
156  the transactional cache.
157  */
159 
160  /*
161  This is the list of tables that are involved in this transaction and its
162  information
163  */
166 
167  /*
168  Context information about system variables in the transaction
169  */
171 
172  /// pointer to the status var original_commit_timestamp
174 
175  /** Replication channel info associated to this transaction/THD */
177 
178  /** contains the session value of group_replication_consistency */
180 
181  /** value of session wait_timeout, timeout to hold transaction */
183 
184  /// pointer to original_server_version
186 
187  /// pointer to immediate_server_version
189 } Trans_param;
190 
191 /**
192  Transaction observer parameter initialization.
193 */
194 #define TRANS_PARAM_ZERO(trans_param_obj) \
195  memset(&trans_param_obj, 0, sizeof(Trans_param));
196 
197 typedef int (*before_dml_t)(Trans_param *param, int &out_val);
198 
199 /**
200  This callback is called before transaction commit
201 
202  This callback is called right before write binlog cache to
203  binary log.
204 
205  @param param The parameter for transaction observers
206 
207  @retval 0 Success
208  @retval 1 Failure
209 */
210 typedef int (*before_commit_t)(Trans_param *param);
211 
212 /**
213  This callback is called before transaction rollback
214 
215  This callback is called before rollback to storage engines.
216 
217  @param param The parameter for transaction observers
218 
219  @retval 0 Success
220  @retval 1 Failure
221 */
222 typedef int (*before_rollback_t)(Trans_param *param);
223 
224 /**
225  This callback is called after transaction commit
226 
227  This callback is called right after commit to storage engines for
228  transactional tables.
229 
230  For non-transactional tables, this is called at the end of the
231  statement, before sending statement status, if the statement
232  succeeded.
233 
234  @note The return value is currently ignored by the server.
235 
236  @param param The parameter for transaction observers
237 
238  @retval 0 Success
239  @retval 1 Failure
240 */
241 typedef int (*after_commit_t)(Trans_param *param);
242 
243 /**
244  This callback is called after transaction rollback
245 
246  This callback is called right after rollback to storage engines
247  for transactional tables.
248 
249  For non-transactional tables, this is called at the end of the
250  statement, before sending statement status, if the statement
251  failed.
252 
253  @note The return value is currently ignored by the server.
254 
255  @param param The parameter for transaction observers
256 
257  @retval 0 Success
258  @retval 1 Failure
259 */
260 typedef int (*after_rollback_t)(Trans_param *param);
261 
262 /**
263  This callback is called before a sql command is executed.
264 
265  @param param The parameter for transaction observers
266  @param out_val Return value from observer execution
267 
268  @retval 0 Success
269  @retval 1 Failure
270 */
271 typedef int (*begin_t)(Trans_param *param, int &out_val);
272 
273 /**
274  Observes and extends transaction execution
275 */
276 typedef struct Trans_observer {
277  uint32 len;
278 
286 
287 /**
288  Binlog storage flags
289 */
291  /** Binary log was sync:ed */
293 };
294 
295 typedef struct Server_state_param {
296  uint32 server_id;
298 
299 /**
300  This is called just before the server is ready to accept the client
301  connections to the Server/Node. It marks the possible point where the
302  server can be said to be ready to serve client queries.
303 
304  @param[in] param Observer common parameter
305 
306  @retval 0 Success
307  @retval >0 Failure
308 */
310 
311 /**
312  This callback is called before the start of the recovery
313 
314  @param[in] param Observer common parameter
315 
316  @retval 0 Success
317  @retval >0 Failure
318 */
319 typedef int (*before_recovery_t)(Server_state_param *param);
320 
321 /**
322  This callback is called after the end of the engine recovery.
323 
324  This is called before the start of the recovery procedure ie.
325  the engine recovery.
326 
327  @param[in] param Observer common parameter
328 
329  @retval 0 Success
330  @retval >0 Failure
331 */
333 
334 /**
335  This callback is called after the end of the recovery procedure.
336 
337  @param[in] param Observer common parameter
338 
339  @retval 0 Success
340  @retval >0 Failure
341 */
342 typedef int (*after_recovery_t)(Server_state_param *param);
343 
344 /**
345  This callback is called before the start of the shutdown procedure.
346  Can be useful to initiate some cleanup operations in some cases.
347 
348  @param[in] param Observer common parameter
349 
350  @retval 0 Success
351  @retval >0 Failure
352 */
354 
355 /**
356  This callback is called after the end of the shutdown procedure.
357  Can be used as a checkpoint of the proper cleanup operations in some cases.
358 
359  @param[in] param Observer common parameter
360 
361  @retval 0 Success
362  @retval >0 Failure
363 */
365 
366 /**
367  Observer server state
368  */
369 typedef struct Server_state_observer {
370  uint32 len;
371 
379 
380 /**
381  Binlog storage observer parameters
382  */
383 typedef struct Binlog_storage_param {
384  uint32 server_id;
386 
387 /**
388  This callback is called after binlog has been flushed
389 
390  This callback is called after cached events have been flushed to
391  binary log file but not yet synced.
392 
393  @param param Observer common parameter
394  @param log_file Binlog file name been updated
395  @param log_pos Binlog position after update
396 
397  @retval 0 Success
398  @retval 1 Failure
399 */
400 typedef int (*after_flush_t)(Binlog_storage_param *param, const char *log_file,
401  my_off_t log_pos);
402 typedef int (*after_sync_t)(Binlog_storage_param *param, const char *log_file,
403  my_off_t log_pos);
404 
405 /**
406  Observe binlog logging storage
407 */
408 typedef struct Binlog_storage_observer {
409  uint32 len;
410 
414 
415 /**
416  Replication binlog transmitter (binlog dump) observer parameter.
417 */
418 typedef struct Binlog_transmit_param {
419  uint32 server_id;
420  uint32 flags;
421  /* Let us keep 1-16 as output flags and 17-32 as input flags */
422  static const uint32 F_OBSERVE = 1;
423  static const uint32 F_DONT_OBSERVE = 2;
424 
427  /**
428  If F_OBSERVE is set by any plugin, then it should observe binlog
429  transmission, even F_DONT_OBSERVE is set by some plugins.
430 
431  If both F_OBSERVE and F_DONT_OBSERVE are not set, then it is an old
432  plugin. In this case, it should always observe binlog transmission.
433  */
434  bool should_observe() {
435  return (flags & F_OBSERVE) || !(flags & F_DONT_OBSERVE);
436  }
438 
439 /**
440  This callback is called when binlog dumping starts
441 
442  @param param Observer common parameter
443  @param log_file Binlog file name to transmit from
444  @param log_pos Binlog position to transmit from
445 
446  @retval 0 Success
447  @retval 1 Failure
448 */
450  const char *log_file, my_off_t log_pos);
451 
452 /**
453  This callback is called when binlog dumping stops
454 
455  @param param Observer common parameter
456 
457  @retval 0 Success
458  @retval 1 Failure
459 */
460 typedef int (*transmit_stop_t)(Binlog_transmit_param *param);
461 
462 /**
463  This callback is called to reserve bytes in packet header for event
464  transmission
465 
466  This callback is called when resetting transmit packet header to
467  reserve bytes for this observer in packet header.
468 
469  The @a header buffer is allocated by the server code, and @a size
470  is the size of the header buffer. Each observer can only reserve
471  a maximum size of @a size in the header.
472 
473  @param param Observer common parameter
474  @param header Pointer of the header buffer
475  @param size Size of the header buffer
476  @param len Header length reserved by this observer
477 
478  @retval 0 Success
479  @retval 1 Failure
480 */
482  unsigned char *header, unsigned long size,
483  unsigned long *len);
484 
485 /**
486  This callback is called before sending an event packet to slave
487 
488  @param param Observer common parameter
489  @param packet Binlog event packet to send
490  @param len Length of the event packet
491  @param log_file Binlog file name of the event packet to send
492  @param log_pos Binlog position of the event packet to send
493 
494  @retval 0 Success
495  @retval 1 Failure
496 */
498  unsigned char *packet, unsigned long len,
499  const char *log_file, my_off_t log_pos);
500 
501 /**
502  This callback is called after an event packet is sent to the
503  slave or is skipped.
504 
505  @param param Observer common parameter
506  @param event_buf Binlog event packet buffer sent
507  @param len length of the event packet buffer
508  @param skipped_log_file Binlog file name of the event that
509  was skipped in the master. This is
510  null if the position was not skipped
511  @param skipped_log_pos Binlog position of the event that
512  was skipped in the master. 0 if not
513  skipped
514  @retval 0 Success
515  @retval 1 Failure
516 */
518  const char *event_buf, unsigned long len,
519  const char *skipped_log_file,
520  my_off_t skipped_log_pos);
521 
522 /**
523  This callback is called after resetting master status
524 
525  This is called when executing the command RESET MASTER, and is
526  used to reset status variables added by observers.
527 
528  @param param Observer common parameter
529 
530  @retval 0 Success
531  @retval 1 Failure
532 */
534 
535 /**
536  Observe and extends the binlog dumping thread.
537 */
538 typedef struct Binlog_transmit_observer {
539  uint32 len;
540 
548 
549 /**
550  Binlog relay IO flags
551 */
553  /** Binary relay log was sync:ed */
555 };
556 
557 /**
558  Replication binlog relay IO observer parameter
559 */
560 typedef struct Binlog_relay_IO_param {
561  uint32 server_id;
563 
564  /* Channel name */
566 
567  /* Master host, user and port */
568  char *host;
569  char *user;
570  unsigned int port;
571 
574 
575  MYSQL *mysql; /* the connection to master */
577 
578 /**
579  This callback is called when slave IO thread starts
580 
581  @param param Observer common parameter
582 
583  @retval 0 Success
584  @retval 1 Failure
585 */
586 typedef int (*thread_start_t)(Binlog_relay_IO_param *param);
587 
588 /**
589  This callback is called when slave IO thread stops
590 
591  @param param Observer common parameter
592 
593  @retval 0 Success
594  @retval 1 Failure
595 */
596 typedef int (*thread_stop_t)(Binlog_relay_IO_param *param);
597 
598 /**
599  This callback is called when a relay log consumer thread starts
600 
601  @param param Observer common parameter
602 
603  @retval 0 Sucess
604  @retval 1 Failure
605 */
606 typedef int (*applier_start_t)(Binlog_relay_IO_param *param);
607 
608 /**
609  This callback is called when a relay log consumer thread stops
610 
611  @param param Observer common parameter
612  @param aborted thread aborted or exited on error
613 
614  @retval 0 Success
615  @retval 1 Failure
616 */
617 typedef int (*applier_stop_t)(Binlog_relay_IO_param *param, bool aborted);
618 
619 /**
620  This callback is called before slave requesting binlog transmission from
621  master
622 
623  This is called before slave issuing BINLOG_DUMP command to master
624  to request binlog.
625 
626  @param param Observer common parameter
627  @param flags binlog dump flags
628 
629  @retval 0 Success
630  @retval 1 Failure
631 */
633  uint32 flags);
634 
635 /**
636  This callback is called after read an event packet from master
637 
638  @param param Observer common parameter
639  @param packet The event packet read from master
640  @param len Length of the event packet read from master
641  @param event_buf The event packet return after process
642  @param event_len The length of event packet return after process
643 
644  @retval 0 Success
645  @retval 1 Failure
646 */
648  const char *packet, unsigned long len,
649  const char **event_buf,
650  unsigned long *event_len);
651 
652 /**
653  This callback is called after written an event packet to relay log
654 
655  @param param Observer common parameter
656  @param event_buf Event packet written to relay log
657  @param event_len Length of the event packet written to relay log
658  @param flags flags for relay log
659 
660  @retval 0 Success
661  @retval 1 Failure
662 */
664  const char *event_buf,
665  unsigned long event_len, uint32 flags);
666 
667 /**
668  This callback is called after reset slave relay log IO status
669 
670  @param param Observer common parameter
671 
672  @retval 0 Success
673  @retval 1 Failure
674 */
676 
677 /**
678  This callback is called before event gets applied
679 
680  @param param Observer common parameter
681  @param reason Event skip reason
682 
683  @retval 0 Success
684  @retval 1 Failure
685 */
687  Trans_param *trans_param, int &out);
688 
689 /**
690  Observes and extends the service of slave IO thread.
691 */
692 typedef struct Binlog_relay_IO_observer {
693  uint32 len;
694 
705 
706 /**
707  Register a transaction observer
708 
709  @param observer The transaction observer to register
710  @param p pointer to the internal plugin structure
711 
712  @retval 0 Sucess
713  @retval 1 Observer already exists
714 */
715 int register_trans_observer(Trans_observer *observer, void *p);
716 
717 /**
718  Unregister a transaction observer
719 
720  @param observer The transaction observer to unregister
721  @param p pointer to the internal plugin structure
722 
723  @retval 0 Sucess
724  @retval 1 Observer not exists
725 */
726 int unregister_trans_observer(Trans_observer *observer, void *p);
727 
728 /**
729  Register a binlog storage observer
730 
731  @param observer The binlog storage observer to register
732  @param p pointer to the internal plugin structure
733 
734  @retval 0 Sucess
735  @retval 1 Observer already exists
736 */
738  void *p);
739 
740 /**
741  Unregister a binlog storage observer
742 
743  @param observer The binlog storage observer to unregister
744  @param p pointer to the internal plugin structure
745 
746  @retval 0 Sucess
747  @retval 1 Observer not exists
748 */
750  void *p);
751 
752 /**
753  Register a binlog transmit observer
754 
755  @param observer The binlog transmit observer to register
756  @param p pointer to the internal plugin structure
757 
758  @retval 0 Sucess
759  @retval 1 Observer already exists
760 */
762  void *p);
763 
764 /**
765  Unregister a binlog transmit observer
766 
767  @param observer The binlog transmit observer to unregister
768  @param p pointer to the internal plugin structure
769 
770  @retval 0 Sucess
771  @retval 1 Observer not exists
772 */
774  void *p);
775 
776 /**
777  Register a server state observer
778 
779  @param observer The server state observer to register
780  @param p pointer to the internal plugin structure
781 
782  @retval 0 Success
783  @retval 1 Observer already exists
784 */
786 
787 /**
788  Unregister a server state observer
789 
790  @param observer The server state observer to unregister
791  @param p pointer to the internal plugin structure
792 
793  @retval 0 Success
794  @retval 1 Observer not exists
795 */
797 
798 /**
799  Register a binlog relay IO (slave IO thread) observer
800 
801  @param observer The binlog relay IO observer to register
802  @param p pointer to the internal plugin structure
803 
804  @retval 0 Sucess
805  @retval 1 Observer already exists
806 */
808  void *p);
809 
810 /**
811  Unregister a binlog relay IO (slave IO thread) observer
812 
813  @param observer The binlog relay IO observer to unregister
814  @param p pointer to the internal plugin structure
815 
816  @retval 0 Sucess
817  @retval 1 Observer not exists
818 */
820  void *p);
821 
822 /**
823  Set thread entering a condition
824 
825  This function should be called before putting a thread to wait for
826  a condition. @p mutex should be held before calling this
827  function. After being waken up, @c thd_exit_cond should be called.
828 
829  @param opaque_thd The thread entering the condition, NULL means current
830  thread
831  @param cond The condition the thread is going to wait for
832  @param mutex The mutex associated with the condition, this must be
833  held before call this function
834  @param stage The new process message for the thread
835  @param old_stage The old process message for the thread
836  @param src_function The caller source function name
837  @param src_file The caller source file name
838  @param src_line The caller source line number
839 */
840 void thd_enter_cond(void *opaque_thd, mysql_cond_t *cond, mysql_mutex_t *mutex,
841  const PSI_stage_info *stage, PSI_stage_info *old_stage,
842  const char *src_function, const char *src_file,
843  int src_line);
844 
845 #define THD_ENTER_COND(P1, P2, P3, P4, P5) \
846  thd_enter_cond(P1, P2, P3, P4, P5, __func__, __FILE__, __LINE__)
847 
848 /**
849  Set thread leaving a condition
850 
851  This function should be called after a thread being waken up for a
852  condition.
853 
854  @param opaque_thd The thread entering the condition, NULL means current
855  thread
856  @param stage The process message, usually this should be the old process
857  message before calling @c thd_enter_cond
858  @param src_function The caller source function name
859  @param src_file The caller source file name
860  @param src_line The caller source line number
861 */
862 void thd_exit_cond(void *opaque_thd, const PSI_stage_info *stage,
863  const char *src_function, const char *src_file,
864  int src_line);
865 
866 #define THD_EXIT_COND(P1, P2) \
867  thd_exit_cond(P1, P2, __func__, __FILE__, __LINE__)
868 
869 /**
870  Get the value of user variable as an integer.
871 
872  This function will return the value of variable @a name as an
873  integer. If the original value of the variable is not an integer,
874  the value will be converted into an integer.
875 
876  @param name user variable name
877  @param value pointer to return the value
878  @param null_value if not NULL, the function will set it to true if
879  the value of variable is null, set to false if not
880 
881  @retval 0 Success
882  @retval 1 Variable not found
883 */
884 int get_user_var_int(const char *name, long long int *value, int *null_value);
885 
886 /**
887  Get the value of user variable as a double precision float number.
888 
889  This function will return the value of variable @a name as real
890  number. If the original value of the variable is not a real number,
891  the value will be converted into a real number.
892 
893  @param name user variable name
894  @param value pointer to return the value
895  @param null_value if not NULL, the function will set it to true if
896  the value of variable is null, set to false if not
897 
898  @retval 0 Success
899  @retval 1 Variable not found
900 */
901 int get_user_var_real(const char *name, double *value, int *null_value);
902 
903 /**
904  Get the value of user variable as a string.
905 
906  This function will return the value of variable @a name as
907  string. If the original value of the variable is not a string,
908  the value will be converted into a string.
909 
910  @param name user variable name
911  @param value pointer to the value buffer
912  @param len length of the value buffer
913  @param precision precision of the value if it is a float number
914  @param null_value if not NULL, the function will set it to true if
915  the value of variable is null, set to false if not
916 
917  @retval 0 Success
918  @retval 1 Variable not found
919 */
920 int get_user_var_str(const char *name, char *value, size_t len,
921  unsigned int precision, int *null_value);
922 
923 #ifdef __cplusplus
924 }
925 #endif
926 #endif /* REPLICATION_H */
bool should_observe()
If F_OBSERVE is set by any plugin, then it should observe binlog transmission, even F_DONT_OBSERVE is...
Definition: replication.h:434
LogFile log_file
Definition: mysqltest.cc:1253
uint32 server_id
Definition: replication.h:384
ulonglong uint64
Definition: my_inttypes.h:72
This represents table metadata involved in a transaction
Definition: replication.h:71
unsigned long long int ulonglong
Definition: my_inttypes.h:69
int(* after_flush_t)(Binlog_storage_param *param, const char *log_file, my_off_t log_pos)
This callback is called after binlog has been flushed.
Definition: replication.h:400
struct Binlog_relay_IO_observer Binlog_relay_IO_observer
Observes and extends the service of slave IO thread.
after_recovery_t after_recovery
Definition: replication.h:375
begin_t begin
Definition: replication.h:284
void thd_exit_cond(void *opaque_thd, const PSI_stage_info *stage, const char *src_function, const char *src_file, int src_line)
Set thread leaving a condition.
Definition: sql_thd_internal_api.cc:136
uint32 len
Definition: replication.h:370
ulong parallel_applier_type
Definition: replication.h:106
int(* before_handle_connection_t)(Server_state_param *param)
This is called just before the server is ready to accept the client connections to the Server/Node...
Definition: replication.h:309
char * tls_version
Definition: replication.h:51
ulong type
Definition: replication.h:118
const string name("\ame\)
int get_user_var_str(const char *name, char *value, size_t len, unsigned int precision, int *null_value)
Get the value of user variable as a string.
Definition: rpl_handler.cc:140
struct Binlog_transmit_param Binlog_transmit_param
Replication binlog transmitter (binlog dump) observer parameter.
int(* after_commit_t)(Trans_param *param)
This callback is called after transaction commit.
Definition: replication.h:241
uint32 len
Definition: replication.h:409
An instrumented cond structure.
Definition: mysql_cond_bits.h:49
struct Trans_table_info Trans_table_info
This represents table metadata involved in a transaction
before_dml_t before_dml
Definition: replication.h:279
Transaction observer parameter.
Definition: replication.h:127
after_flush_t after_flush
Definition: replication.h:411
pthread_mutex_t mutex
Definition: memcached.c:384
int(* thread_start_t)(Binlog_relay_IO_param *param)
This callback is called when slave IO thread starts.
Definition: replication.h:586
after_engine_recovery_t after_engine_recovery
Definition: replication.h:374
Observes and extends the service of slave IO thread.
Definition: replication.h:692
before_request_transmit_t before_request_transmit
Definition: replication.h:699
int(* before_server_shutdown_t)(Server_state_param *param)
This callback is called before the start of the shutdown procedure.
Definition: replication.h:353
int register_trans_observer(Trans_observer *observer, void *p)
Register a transaction observer.
Definition: rpl_handler.cc:954
before_send_event_t before_send_event
Definition: replication.h:544
char * ssl_cert
Definition: replication.h:52
after_reset_master_t after_reset_master
Definition: replication.h:546
after_rollback_t after_rollback
Definition: replication.h:283
int(* before_request_transmit_t)(Binlog_relay_IO_param *param, uint32 flags)
This callback is called before slave requesting binlog transmission from master.
Definition: replication.h:632
ulong group_replication_consistency
contains the session value of group_replication_consistency
Definition: replication.h:179
struct Server_state_param Server_state_param
transmit_start_t transmit_start
Definition: replication.h:541
int get_user_var_real(const char *name, double *value, int *null_value)
Get the value of user variable as a double precision float number.
Definition: rpl_handler.cc:122
ulong hold_timeout
value of session wait_timeout, timeout to hold transaction
Definition: replication.h:182
int unregister_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p)
Unregister a binlog transmit observer.
Definition: rpl_handler.cc:994
int(* transmit_start_t)(Binlog_transmit_param *param, const char *log_file, my_off_t log_pos)
This callback is called when binlog dumping starts.
Definition: replication.h:449
const char * server_uuid
Definition: replication.h:129
Trans_context_info trans_ctx_info
Definition: replication.h:170
bool binlog_enabled
Definition: replication.h:95
after_reset_slave_t after_reset_slave
Definition: replication.h:702
Observe and extends the binlog dumping thread.
Definition: replication.h:538
static const uint32 F_DONT_OBSERVE
Definition: replication.h:423
ulong parallel_applier_workers
Definition: replication.h:107
my_off_t master_log_pos
Definition: replication.h:573
my_thread_id thread_id
Definition: replication.h:130
int unregister_binlog_storage_observer(Binlog_storage_observer *observer, void *p)
Unregister a binlog storage observer.
Definition: rpl_handler.cc:970
int(* before_dml_t)(Trans_param *param, int &out_val)
Definition: replication.h:197
bool has_cascade_foreign_key
information to store if the table has foreign key with 'CASCADE' clause.
Definition: replication.h:77
uint32 flags
Definition: replication.h:131
struct Trans_observer Trans_observer
Observes and extends transaction execution.
bool is_atomic_ddl
Definition: replication.h:158
int sidno
Definition: replication.h:119
unsigned int port
Definition: replication.h:570
uint number_of_tables
Definition: replication.h:165
uint32 flags
Definition: replication.h:420
ulong binlog_format
Definition: replication.h:100
ulong mi_repository_type
Definition: replication.h:103
enum_rpl_channel_type rpl_channel_type
Replication channel info associated to this transaction/THD.
Definition: replication.h:176
my_off_t log_pos
Definition: replication.h:141
bool have_ssl_opt
Definition: replication.h:48
Trans_table_info * tables_info
Definition: replication.h:164
void set_observe_flag()
Definition: replication.h:425
int unregister_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p)
Unregister a binlog relay IO (slave IO thread) observer.
Definition: rpl_handler.cc:1004
after_commit_t after_commit
Definition: replication.h:282
my_thread_id thread_id
Definition: replication.h:562
Observes and extends transaction execution.
Definition: replication.h:276
Transaction is a real transaction.
Definition: replication.h:65
int db_type
The db_type of the storage engine used by the table.
Definition: replication.h:75
Trans_flags
Transaction observer flags.
Definition: replication.h:63
thread_start_t thread_start
Definition: replication.h:695
int(* begin_t)(Trans_param *param, int &out_val)
This callback is called before a sql command is executed.
Definition: replication.h:271
bool parallel_applier_preserve_commit_order
Definition: replication.h:108
uint number_of_primary_keys
Definition: replication.h:73
char * ssl_cipher
Definition: replication.h:53
int(* applier_stop_t)(Binlog_relay_IO_param *param, bool aborted)
This callback is called when a relay log consumer thread stops.
Definition: replication.h:617
Stage instrument information.
Definition: psi_stage_bits.h:71
Replication binlog transmitter (binlog dump) observer parameter.
Definition: replication.h:418
This represents the GTID context of the transaction.
Definition: replication.h:117
uint32_t * original_server_version
pointer to original_server_version
Definition: replication.h:185
Binlog_relay_IO_flags
Binlog relay IO flags.
Definition: replication.h:552
Binlog storage observer parameters.
Definition: replication.h:383
void thd_enter_cond(void *opaque_thd, mysql_cond_t *cond, mysql_mutex_t *mutex, const PSI_stage_info *stage, PSI_stage_info *old_stage, const char *src_function, const char *src_file, int src_line)
Set thread entering a condition.
Definition: sql_thd_internal_api.cc:123
Binlog_cache_storage * stmt_cache_log
Definition: replication.h:152
int(* after_read_event_t)(Binlog_relay_IO_param *param, const char *packet, unsigned long len, const char **event_buf, unsigned long *event_len)
This callback is called after read an event packet from master.
Definition: replication.h:647
int(* after_recovery_t)(Server_state_param *param)
This callback is called after the end of the recovery procedure.
Definition: replication.h:342
char * ssl_capath
Definition: replication.h:50
struct Trans_context_info Trans_context_info
This represents some of the context in which a transaction is running It summarizes all necessary req...
applier_log_event_t applier_log_event
Definition: replication.h:703
int(* after_server_shutdown_t)(Server_state_param *param)
This callback is called after the end of the shutdown procedure.
Definition: replication.h:364
int(* applier_log_event_t)(Binlog_relay_IO_param *param, Trans_param *trans_param, int &out)
This callback is called before event gets applied.
Definition: replication.h:686
unsigned int len
Definition: dbug_analyze.cc:216
int(* before_commit_t)(Trans_param *param)
This callback is called before transaction commit.
Definition: replication.h:210
unsigned int uint
Definition: uca-dump.cc:29
char * ssl_key
Definition: replication.h:54
Binary relay log was sync:ed.
Definition: replication.h:554
uint32 server_id
Definition: replication.h:419
thread_stop_t thread_stop
Definition: replication.h:696
after_send_event_t after_send_event
Definition: replication.h:545
struct Binlog_relay_IO_param Binlog_relay_IO_param
Replication binlog relay IO observer parameter.
uint32 server_id
Definition: replication.h:296
Instrumentation helpers for mysys threads.
Replication binlog relay IO observer parameter.
Definition: replication.h:560
int(* after_queue_event_t)(Binlog_relay_IO_param *param, const char *event_buf, unsigned long event_len, uint32 flags)
This callback is called after written an event packet to relay log.
Definition: replication.h:663
Definition: replication.h:295
char * host
Definition: replication.h:568
int(* after_send_event_t)(Binlog_transmit_param *param, const char *event_buf, unsigned long len, const char *skipped_log_file, my_off_t skipped_log_pos)
This callback is called after an event packet is sent to the slave or is skipped. ...
Definition: replication.h:517
before_server_shutdown_t before_server_shutdown
Definition: replication.h:376
uint32 len
Definition: replication.h:277
bool log_slave_updates
Definition: replication.h:97
struct Binlog_transmit_observer Binlog_transmit_observer
Observe and extends the binlog dumping thread.
int(* after_sync_t)(Binlog_storage_param *param, const char *log_file, my_off_t log_pos)
Definition: replication.h:402
char * master_log_name
Definition: replication.h:572
reserve_header_t reserve_header
Definition: replication.h:543
ulong binlog_checksum_options
Definition: replication.h:98
ulong gtid_mode
Definition: replication.h:96
Observe binlog logging storage.
Definition: replication.h:408
unsigned long my_off_t
Definition: my_inttypes.h:88
int(* applier_start_t)(Binlog_relay_IO_param *param)
This callback is called when a relay log consumer thread starts.
Definition: replication.h:606
This represents some of the context in which a transaction is running It summarizes all necessary req...
Definition: replication.h:94
after_server_shutdown_t after_server_shutdown
Definition: replication.h:377
after_queue_event_t after_queue_event
Definition: replication.h:701
struct Trans_param Trans_param
Transaction observer parameter.
uint32 my_thread_id
Definition: my_thread_local.h:33
uint32 len
Definition: replication.h:539
void set_dont_observe_flag()
Definition: replication.h:426
char * ssl_crlpath
Definition: replication.h:56
uint32 server_id
Definition: replication.h:561
Observer server state.
Definition: replication.h:369
static const uint32 F_OBSERVE
Definition: replication.h:422
Binary log was sync:ed.
Definition: replication.h:292
int(* reserve_header_t)(Binlog_transmit_param *param, unsigned char *header, unsigned long size, unsigned long *len)
This callback is called to reserve bytes in packet header for event transmission. ...
Definition: replication.h:481
transmit_stop_t transmit_stop
Definition: replication.h:542
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:49
struct Trans_gtid_info Trans_gtid_info
This represents the GTID context of the transaction.
uint32_t * immediate_server_version
pointer to immediate_server_version
Definition: replication.h:188
before_rollback_t before_rollback
Definition: replication.h:281
enum_rpl_channel_type
Type of replication channel thread/transaction might be associated to.
Definition: rpl_context.h:37
uint32 len
Definition: replication.h:693
enum_tx_isolation tx_isolation
Definition: replication.h:109
before_recovery_t before_recovery
Definition: replication.h:373
Binlog_storage_flags
Binlog storage flags.
Definition: replication.h:290
Binlog_cache_storage * trx_cache_log
Definition: replication.h:151
after_sync_t after_sync
Definition: replication.h:412
int register_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p)
Register a binlog relay IO (slave IO thread) observer.
Definition: rpl_handler.cc:999
int(* before_recovery_t)(Server_state_param *param)
This callback is called before the start of the recovery.
Definition: replication.h:319
const char * p
Definition: ctype-mb.cc:1227
before_handle_connection_t before_handle_connection
Definition: replication.h:372
ulonglong cache_log_max_size
Definition: replication.h:153
const string value("\alue\)
char * ssl_ca
Definition: replication.h:49
int register_binlog_storage_observer(Binlog_storage_observer *observer, void *p)
Register a binlog storage observer.
Definition: rpl_handler.cc:962
int unregister_trans_observer(Trans_observer *observer, void *p)
Unregister a transaction observer.
Definition: rpl_handler.cc:958
char * user
Definition: replication.h:569
Definition: mysql.h:294
int unregister_server_state_observer(Server_state_observer *observer, void *p)
Unregister a server state observer.
Definition: rpl_handler.cc:983
char * channel_name
Definition: replication.h:565
Byte container that provides a storage for serializing session binlog events.
Definition: binlog_ostream.h:144
applier_stop_t applier_stop
Definition: replication.h:698
int(* transmit_stop_t)(Binlog_transmit_param *param)
This callback is called when binlog dumping stops.
Definition: replication.h:460
struct Server_state_observer Server_state_observer
Observer server state.
int register_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p)
Register a binlog transmit observer.
Definition: rpl_handler.cc:989
int(* before_rollback_t)(Trans_param *param)
This callback is called before transaction rollback.
Definition: replication.h:222
const char * log_file
Definition: replication.h:140
static int flags[50]
Definition: hp_test1.cc:39
applier_start_t applier_start
Definition: replication.h:697
uint64 * original_commit_timestamp
pointer to the status var original_commit_timestamp
Definition: replication.h:173
Trans_gtid_info gtid_info
Definition: replication.h:146
before_commit_t before_commit
Definition: replication.h:280
int(* after_rollback_t)(Trans_param *param)
This callback is called after transaction rollback.
Definition: replication.h:260
bool default_table_encryption
Definition: replication.h:111
int(* after_reset_slave_t)(Binlog_relay_IO_param *param)
This callback is called after reset slave relay log IO status.
Definition: replication.h:675
ulong transaction_write_set_extraction
Definition: replication.h:102
char * ssl_crl
Definition: replication.h:55
int(* thread_stop_t)(Binlog_relay_IO_param *param)
This callback is called when slave IO thread stops.
Definition: replication.h:596
int(* before_send_event_t)(Binlog_transmit_param *param, unsigned char *packet, unsigned long len, const char *log_file, my_off_t log_pos)
This callback is called before sending an event packet to slave.
Definition: replication.h:497
int register_server_state_observer(Server_state_observer *observer, void *p)
Register a server state observer.
Definition: rpl_handler.cc:975
long long int gno
Definition: replication.h:120
unsigned long ulong
Definition: my_inttypes.h:46
enum_tx_isolation
Definition: handler.h:2527
ulong rli_repository_type
Definition: replication.h:104
uint lower_case_table_names
Definition: replication.h:110
after_read_event_t after_read_event
Definition: replication.h:700
const char * table_name
Definition: replication.h:72
uint32 server_id
Definition: replication.h:128
int(* after_engine_recovery_t)(Server_state_param *param)
This callback is called after the end of the engine recovery.
Definition: replication.h:332
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:776
int(* after_reset_master_t)(Binlog_transmit_param *param)
This callback is called after resetting master status.
Definition: replication.h:533
unsigned int ssl_fips_mode
Definition: replication.h:57
int get_user_var_int(const char *name, long long int *value, int *null_value)
Get the value of user variable as an integer.
Definition: rpl_handler.cc:104
MYSQL * mysql
Definition: replication.h:575
Struct to share server ssl variables.
Definition: replication.h:47
struct Binlog_storage_param Binlog_storage_param
Binlog storage observer parameters.
struct Binlog_storage_observer Binlog_storage_observer
Observe binlog logging storage.