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