MySQL  8.0.17
Source Code Documentation
replication.h
Go to the documentation of this file.
1 /* Copyright (c) 2008, 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 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  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 enum_gtid_mode
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
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 } Trans_param;
194 
195 /**
196  Transaction observer parameter initialization.
197 */
198 #define TRANS_PARAM_ZERO(trans_param_obj) \
199  memset(&trans_param_obj, 0, sizeof(Trans_param));
200 
201 typedef int (*before_dml_t)(Trans_param *param, int &out_val);
202 
203 /**
204  This callback is called before transaction commit
205 
206  This callback is called right before write binlog cache to
207  binary log.
208 
209  @param param The parameter for transaction observers
210 
211  @retval 0 Success
212  @retval 1 Failure
213 */
214 typedef int (*before_commit_t)(Trans_param *param);
215 
216 /**
217  This callback is called before transaction rollback
218 
219  This callback is called before rollback to storage engines.
220 
221  @param param The parameter for transaction observers
222 
223  @retval 0 Success
224  @retval 1 Failure
225 */
226 typedef int (*before_rollback_t)(Trans_param *param);
227 
228 /**
229  This callback is called after transaction commit
230 
231  This callback is called right after commit to storage engines for
232  transactional tables.
233 
234  For non-transactional tables, this is called at the end of the
235  statement, before sending statement status, if the statement
236  succeeded.
237 
238  @note The return value is currently ignored by the server.
239 
240  @param param The parameter for transaction observers
241 
242  @retval 0 Success
243  @retval 1 Failure
244 */
245 typedef int (*after_commit_t)(Trans_param *param);
246 
247 /**
248  This callback is called after transaction rollback
249 
250  This callback is called right after rollback to storage engines
251  for transactional tables.
252 
253  For non-transactional tables, this is called at the end of the
254  statement, before sending statement status, if the statement
255  failed.
256 
257  @note The return value is currently ignored by the server.
258 
259  @param param The parameter for transaction observers
260 
261  @retval 0 Success
262  @retval 1 Failure
263 */
264 typedef int (*after_rollback_t)(Trans_param *param);
265 
266 /**
267  This callback is called before a sql command is executed.
268 
269  @param param The parameter for transaction observers
270  @param out_val Return value from observer execution
271 
272  @retval 0 Success
273  @retval 1 Failure
274 */
275 typedef int (*begin_t)(Trans_param *param, int &out_val);
276 
277 /**
278  Observes and extends transaction execution
279 */
280 typedef struct Trans_observer {
282 
290 
291 /**
292  Binlog storage flags
293 */
295  /** Binary log was sync:ed */
297 };
298 
299 typedef struct Server_state_param {
302 
303 /**
304  This is called just before the server is ready to accept the client
305  connections to the Server/Node. It marks the possible point where the
306  server can be said to be ready to serve client queries.
307 
308  @param[in] param Observer common parameter
309 
310  @retval 0 Success
311  @retval >0 Failure
312 */
314 
315 /**
316  This callback is called before the start of the recovery
317 
318  @param[in] param Observer common parameter
319 
320  @retval 0 Success
321  @retval >0 Failure
322 */
323 typedef int (*before_recovery_t)(Server_state_param *param);
324 
325 /**
326  This callback is called after the end of the engine recovery.
327 
328  This is called before the start of the recovery procedure ie.
329  the engine recovery.
330 
331  @param[in] param Observer common parameter
332 
333  @retval 0 Success
334  @retval >0 Failure
335 */
337 
338 /**
339  This callback is called after the end of the recovery procedure.
340 
341  @param[in] param Observer common parameter
342 
343  @retval 0 Success
344  @retval >0 Failure
345 */
346 typedef int (*after_recovery_t)(Server_state_param *param);
347 
348 /**
349  This callback is called before the start of the shutdown procedure.
350  Can be useful to initiate some cleanup operations in some cases.
351 
352  @param[in] param Observer common parameter
353 
354  @retval 0 Success
355  @retval >0 Failure
356 */
358 
359 /**
360  This callback is called after the end of the shutdown procedure.
361  Can be used as a checkpoint of the proper cleanup operations in some cases.
362 
363  @param[in] param Observer common parameter
364 
365  @retval 0 Success
366  @retval >0 Failure
367 */
369 
370 /**
371  Observer server state
372  */
373 typedef struct Server_state_observer {
375 
383 
384 /**
385  Binlog storage observer parameters
386  */
387 typedef struct Binlog_storage_param {
390 
391 /**
392  This callback is called after binlog has been flushed
393 
394  This callback is called after cached events have been flushed to
395  binary log file but not yet synced.
396 
397  @param param Observer common parameter
398  @param log_file Binlog file name been updated
399  @param log_pos Binlog position after update
400 
401  @retval 0 Success
402  @retval 1 Failure
403 */
404 typedef int (*after_flush_t)(Binlog_storage_param *param, const char *log_file,
405  my_off_t log_pos);
406 typedef int (*after_sync_t)(Binlog_storage_param *param, const char *log_file,
407  my_off_t log_pos);
408 
409 /**
410  Observe binlog logging storage
411 */
412 typedef struct Binlog_storage_observer {
414 
418 
419 /**
420  Replication binlog transmitter (binlog dump) observer parameter.
421 */
422 typedef struct Binlog_transmit_param {
425  /* Let us keep 1-16 as output flags and 17-32 as input flags */
426  static const uint32 F_OBSERVE = 1;
427  static const uint32 F_DONT_OBSERVE = 2;
428 
431  /**
432  If F_OBSERVE is set by any plugin, then it should observe binlog
433  transmission, even F_DONT_OBSERVE is set by some plugins.
434 
435  If both F_OBSERVE and F_DONT_OBSERVE are not set, then it is an old
436  plugin. In this case, it should always observe binlog transmission.
437  */
438  bool should_observe() {
439  return (flags & F_OBSERVE) || !(flags & F_DONT_OBSERVE);
440  }
442 
443 /**
444  This callback is called when binlog dumping starts
445 
446  @param param Observer common parameter
447  @param log_file Binlog file name to transmit from
448  @param log_pos Binlog position to transmit from
449 
450  @retval 0 Success
451  @retval 1 Failure
452 */
454  const char *log_file, my_off_t log_pos);
455 
456 /**
457  This callback is called when binlog dumping stops
458 
459  @param param Observer common parameter
460 
461  @retval 0 Success
462  @retval 1 Failure
463 */
464 typedef int (*transmit_stop_t)(Binlog_transmit_param *param);
465 
466 /**
467  This callback is called to reserve bytes in packet header for event
468  transmission
469 
470  This callback is called when resetting transmit packet header to
471  reserve bytes for this observer in packet header.
472 
473  The @a header buffer is allocated by the server code, and @a size
474  is the size of the header buffer. Each observer can only reserve
475  a maximum size of @a size in the header.
476 
477  @param param Observer common parameter
478  @param header Pointer of the header buffer
479  @param size Size of the header buffer
480  @param len Header length reserved by this observer
481 
482  @retval 0 Success
483  @retval 1 Failure
484 */
486  unsigned char *header, unsigned long size,
487  unsigned long *len);
488 
489 /**
490  This callback is called before sending an event packet to slave
491 
492  @param param Observer common parameter
493  @param packet Binlog event packet to send
494  @param len Length of the event packet
495  @param log_file Binlog file name of the event packet to send
496  @param log_pos Binlog position of the event packet to send
497 
498  @retval 0 Success
499  @retval 1 Failure
500 */
502  unsigned char *packet, unsigned long len,
503  const char *log_file, my_off_t log_pos);
504 
505 /**
506  This callback is called after an event packet is sent to the
507  slave or is skipped.
508 
509  @param param Observer common parameter
510  @param event_buf Binlog event packet buffer sent
511  @param len length of the event packet buffer
512  @param skipped_log_file Binlog file name of the event that
513  was skipped in the master. This is
514  null if the position was not skipped
515  @param skipped_log_pos Binlog position of the event that
516  was skipped in the master. 0 if not
517  skipped
518  @retval 0 Success
519  @retval 1 Failure
520 */
522  const char *event_buf, unsigned long len,
523  const char *skipped_log_file,
524  my_off_t skipped_log_pos);
525 
526 /**
527  This callback is called after resetting master status
528 
529  This is called when executing the command RESET MASTER, and is
530  used to reset status variables added by observers.
531 
532  @param param Observer common parameter
533 
534  @retval 0 Success
535  @retval 1 Failure
536 */
538 
539 /**
540  Observe and extends the binlog dumping thread.
541 */
542 typedef struct Binlog_transmit_observer {
544 
552 
553 /**
554  Binlog relay IO flags
555 */
557  /** Binary relay log was sync:ed */
559 };
560 
561 /**
562  Replication binlog relay IO observer parameter
563 */
564 typedef struct Binlog_relay_IO_param {
567 
568  /* Channel name */
570 
571  /* Master host, user and port */
572  char *host;
573  char *user;
574  unsigned int port;
575 
578 
579  MYSQL *mysql; /* the connection to master */
581 
582 /**
583  This callback is called when slave IO thread starts
584 
585  @param param Observer common parameter
586 
587  @retval 0 Success
588  @retval 1 Failure
589 */
590 typedef int (*thread_start_t)(Binlog_relay_IO_param *param);
591 
592 /**
593  This callback is called when slave IO thread stops
594 
595  @param param Observer common parameter
596 
597  @retval 0 Success
598  @retval 1 Failure
599 */
600 typedef int (*thread_stop_t)(Binlog_relay_IO_param *param);
601 
602 /**
603  This callback is called when a relay log consumer thread starts
604 
605  @param param Observer common parameter
606 
607  @retval 0 Sucess
608  @retval 1 Failure
609 */
610 typedef int (*applier_start_t)(Binlog_relay_IO_param *param);
611 
612 /**
613  This callback is called when a relay log consumer thread stops
614 
615  @param param Observer common parameter
616  @param aborted thread aborted or exited on error
617 
618  @retval 0 Success
619  @retval 1 Failure
620 */
621 typedef int (*applier_stop_t)(Binlog_relay_IO_param *param, bool aborted);
622 
623 /**
624  This callback is called before slave requesting binlog transmission from
625  master
626 
627  This is called before slave issuing BINLOG_DUMP command to master
628  to request binlog.
629 
630  @param param Observer common parameter
631  @param flags binlog dump flags
632 
633  @retval 0 Success
634  @retval 1 Failure
635 */
637  uint32 flags);
638 
639 /**
640  This callback is called after read an event packet from master
641 
642  @param param Observer common parameter
643  @param packet The event packet read from master
644  @param len Length of the event packet read from master
645  @param event_buf The event packet return after process
646  @param event_len The length of event packet return after process
647 
648  @retval 0 Success
649  @retval 1 Failure
650 */
652  const char *packet, unsigned long len,
653  const char **event_buf,
654  unsigned long *event_len);
655 
656 /**
657  This callback is called after written an event packet to relay log
658 
659  @param param Observer common parameter
660  @param event_buf Event packet written to relay log
661  @param event_len Length of the event packet written to relay log
662  @param flags flags for relay log
663 
664  @retval 0 Success
665  @retval 1 Failure
666 */
668  const char *event_buf,
669  unsigned long event_len, uint32 flags);
670 
671 /**
672  This callback is called after reset slave relay log IO status
673 
674  @param param Observer common parameter
675 
676  @retval 0 Success
677  @retval 1 Failure
678 */
680 
681 /**
682  This callback is called before event gets applied
683 
684  @param param Observer common parameter
685  @param reason Event skip reason
686 
687  @retval 0 Success
688  @retval 1 Failure
689 */
691  Trans_param *trans_param, int &out);
692 
693 /**
694  Observes and extends the service of slave IO thread.
695 */
696 typedef struct Binlog_relay_IO_observer {
698 
709 
710 /**
711  Register a transaction observer
712 
713  @param observer The transaction observer to register
714  @param p pointer to the internal plugin structure
715 
716  @retval 0 Sucess
717  @retval 1 Observer already exists
718 */
719 int register_trans_observer(Trans_observer *observer, void *p);
720 
721 /**
722  Unregister a transaction observer
723 
724  @param observer The transaction observer to unregister
725  @param p pointer to the internal plugin structure
726 
727  @retval 0 Sucess
728  @retval 1 Observer not exists
729 */
730 int unregister_trans_observer(Trans_observer *observer, void *p);
731 
732 /**
733  Register a binlog storage observer
734 
735  @param observer The binlog storage observer to register
736  @param p pointer to the internal plugin structure
737 
738  @retval 0 Sucess
739  @retval 1 Observer already exists
740 */
742  void *p);
743 
744 /**
745  Unregister a binlog storage observer
746 
747  @param observer The binlog storage observer to unregister
748  @param p pointer to the internal plugin structure
749 
750  @retval 0 Sucess
751  @retval 1 Observer not exists
752 */
754  void *p);
755 
756 /**
757  Register a binlog transmit observer
758 
759  @param observer The binlog transmit observer to register
760  @param p pointer to the internal plugin structure
761 
762  @retval 0 Sucess
763  @retval 1 Observer already exists
764 */
766  void *p);
767 
768 /**
769  Unregister a binlog transmit observer
770 
771  @param observer The binlog transmit observer to unregister
772  @param p pointer to the internal plugin structure
773 
774  @retval 0 Sucess
775  @retval 1 Observer not exists
776 */
778  void *p);
779 
780 /**
781  Register a server state observer
782 
783  @param observer The server state observer to register
784  @param p pointer to the internal plugin structure
785 
786  @retval 0 Success
787  @retval 1 Observer already exists
788 */
790 
791 /**
792  Unregister a server state observer
793 
794  @param observer The server state observer to unregister
795  @param p pointer to the internal plugin structure
796 
797  @retval 0 Success
798  @retval 1 Observer not exists
799 */
801 
802 /**
803  Register a binlog relay IO (slave IO thread) observer
804 
805  @param observer The binlog relay IO observer to register
806  @param p pointer to the internal plugin structure
807 
808  @retval 0 Sucess
809  @retval 1 Observer already exists
810 */
812  void *p);
813 
814 /**
815  Unregister a binlog relay IO (slave IO thread) observer
816 
817  @param observer The binlog relay IO observer to unregister
818  @param p pointer to the internal plugin structure
819 
820  @retval 0 Sucess
821  @retval 1 Observer not exists
822 */
824  void *p);
825 
826 /**
827  Set thread entering a condition
828 
829  This function should be called before putting a thread to wait for
830  a condition. @p mutex should be held before calling this
831  function. After being waken up, @c thd_exit_cond should be called.
832 
833  @param opaque_thd The thread entering the condition, NULL means current
834  thread
835  @param cond The condition the thread is going to wait for
836  @param mutex The mutex associated with the condition, this must be
837  held before call this function
838  @param stage The new process message for the thread
839  @param old_stage The old process message for the thread
840  @param src_function The caller source function name
841  @param src_file The caller source file name
842  @param src_line The caller source line number
843 */
844 void thd_enter_cond(void *opaque_thd, mysql_cond_t *cond, mysql_mutex_t *mutex,
845  const PSI_stage_info *stage, PSI_stage_info *old_stage,
846  const char *src_function, const char *src_file,
847  int src_line);
848 
849 #define THD_ENTER_COND(P1, P2, P3, P4, P5) \
850  thd_enter_cond(P1, P2, P3, P4, P5, __func__, __FILE__, __LINE__)
851 
852 /**
853  Set thread leaving a condition
854 
855  This function should be called after a thread being waken up for a
856  condition.
857 
858  @param opaque_thd The thread entering the condition, NULL means current
859  thread
860  @param stage The process message, usually this should be the old process
861  message before calling @c thd_enter_cond
862  @param src_function The caller source function name
863  @param src_file The caller source file name
864  @param src_line The caller source line number
865 */
866 void thd_exit_cond(void *opaque_thd, const PSI_stage_info *stage,
867  const char *src_function, const char *src_file,
868  int src_line);
869 
870 #define THD_EXIT_COND(P1, P2) \
871  thd_exit_cond(P1, P2, __func__, __FILE__, __LINE__)
872 
873 /**
874  Get the value of user variable as an integer.
875 
876  This function will return the value of variable @a name as an
877  integer. If the original value of the variable is not an integer,
878  the value will be converted into an integer.
879 
880  @param name user variable name
881  @param value pointer to return the value
882  @param null_value if not NULL, the function will set it to true if
883  the value of variable is null, set to false if not
884 
885  @retval 0 Success
886  @retval 1 Variable not found
887 */
888 int get_user_var_int(const char *name, long long int *value, int *null_value);
889 
890 /**
891  Get the value of user variable as a double precision float number.
892 
893  This function will return the value of variable @a name as real
894  number. If the original value of the variable is not a real number,
895  the value will be converted into a real number.
896 
897  @param name user variable name
898  @param value pointer to return the value
899  @param null_value if not NULL, the function will set it to true if
900  the value of variable is null, set to false if not
901 
902  @retval 0 Success
903  @retval 1 Variable not found
904 */
905 int get_user_var_real(const char *name, double *value, int *null_value);
906 
907 /**
908  Get the value of user variable as a string.
909 
910  This function will return the value of variable @a name as
911  string. If the original value of the variable is not a string,
912  the value will be converted into a string.
913 
914  @param name user variable name
915  @param value pointer to the value buffer
916  @param len length of the value buffer
917  @param precision precision of the value if it is a float number
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_str(const char *name, char *value, size_t len,
925  unsigned int precision, int *null_value);
926 
927 #ifdef __cplusplus
928 }
929 #endif
930 #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:438
uint32 server_id
Definition: replication.h:388
This represents table metadata involved in a transaction
Definition: replication.h:75
unsigned long long int ulonglong
Definition: my_inttypes.h:74
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:404
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:379
begin_t begin
Definition: replication.h:288
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:137
uint32 len
Definition: replication.h:374
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:313
void deinit()
Definition: rpl_group_replication.cc:73
char * tls_version
Definition: replication.h:51
ulong type
Definition: replication.h:122
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:245
uint32 len
Definition: replication.h:413
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:283
Transaction observer parameter.
Definition: replication.h:131
after_flush_t after_flush
Definition: replication.h:415
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:590
after_engine_recovery_t after_engine_recovery
Definition: replication.h:378
Observes and extends the service of slave IO thread.
Definition: replication.h:696
before_request_transmit_t before_request_transmit
Definition: replication.h:703
int(* before_server_shutdown_t)(Server_state_param *param)
This callback is called before the start of the shutdown procedure.
Definition: replication.h:357
int register_trans_observer(Trans_observer *observer, void *p)
Register a transaction observer.
Definition: rpl_handler.cc:955
before_send_event_t before_send_event
Definition: replication.h:548
char * ssl_cert
Definition: replication.h:52
after_reset_master_t after_reset_master
Definition: replication.h:550
after_rollback_t after_rollback
Definition: replication.h:287
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:636
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:545
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:995
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:453
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:706
Observe and extends the binlog dumping thread.
Definition: replication.h:542
static const uint32 F_DONT_OBSERVE
Definition: replication.h:427
ulong parallel_applier_workers
Definition: replication.h:111
my_off_t master_log_pos
Definition: replication.h:577
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:971
int(* before_dml_t)(Trans_param *param, int &out_val)
Definition: replication.h:201
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
unsigned long long uint64
Definition: my_inttypes.h:69
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:574
uint number_of_tables
Definition: replication.h:169
uint32 flags
Definition: replication.h:424
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
bool have_ssl_opt
Definition: replication.h:48
Trans_table_info * tables_info
Definition: replication.h:168
void set_observe_flag()
Definition: replication.h:429
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:1005
after_commit_t after_commit
Definition: replication.h:286
my_thread_id thread_id
Definition: replication.h:566
Observes and extends transaction execution.
Definition: replication.h:280
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:699
int(* begin_t)(Trans_param *param, int &out_val)
This callback is called before a sql command is executed.
Definition: replication.h:275
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:621
Stage instrument information.
Definition: psi_stage_bits.h:71
Replication binlog transmitter (binlog dump) observer parameter.
Definition: replication.h:422
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:556
Binlog storage observer parameters.
Definition: replication.h:387
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:124
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:651
int(* after_recovery_t)(Server_state_param *param)
This callback is called after the end of the recovery procedure.
Definition: replication.h:346
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:707
int(* after_server_shutdown_t)(Server_state_param *param)
This callback is called after the end of the shutdown procedure.
Definition: replication.h:368
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:690
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:214
unsigned int uint
Definition: uca-dump.cc:29
char * ssl_key
Definition: replication.h:54
Binary relay log was sync:ed.
Definition: replication.h:558
uint32 server_id
Definition: replication.h:423
Logfile log_file
Definition: mysqltest.cc:250
thread_stop_t thread_stop
Definition: replication.h:700
after_send_event_t after_send_event
Definition: replication.h:549
struct Binlog_relay_IO_param Binlog_relay_IO_param
Replication binlog relay IO observer parameter.
uint32_t uint32
Definition: my_inttypes.h:62
uint32 server_id
Definition: replication.h:300
Instrumentation helpers for mysys threads.
Replication binlog relay IO observer parameter.
Definition: replication.h:564
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:667
Definition: replication.h:299
char * host
Definition: replication.h:572
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:521
before_server_shutdown_t before_server_shutdown
Definition: replication.h:380
uint32 len
Definition: replication.h:281
bool log_slave_updates
Definition: replication.h:101
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:406
char * master_log_name
Definition: replication.h:576
reserve_header_t reserve_header
Definition: replication.h:547
ulong binlog_checksum_options
Definition: replication.h:102
ulong gtid_mode
Definition: replication.h:100
Observe binlog logging storage.
Definition: replication.h:412
unsigned long my_off_t
Definition: my_inttypes.h:87
int(* applier_start_t)(Binlog_relay_IO_param *param)
This callback is called when a relay log consumer thread starts.
Definition: replication.h:610
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:381
after_queue_event_t after_queue_event
Definition: replication.h:705
struct Trans_param Trans_param
Transaction observer parameter.
uint32 my_thread_id
Definition: my_thread_local.h:33
uint32 len
Definition: replication.h:543
void set_dont_observe_flag()
Definition: replication.h:430
char * ssl_crlpath
Definition: replication.h:56
uint32 server_id
Definition: replication.h:565
Observer server state.
Definition: replication.h:373
static const uint32 F_OBSERVE
Definition: replication.h:426
Binary log was sync:ed.
Definition: replication.h:296
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:485
transmit_stop_t transmit_stop
Definition: replication.h:546
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:192
before_rollback_t before_rollback
Definition: replication.h:285
enum_rpl_channel_type
Type of replication channel thread/transaction might be associated to.
Definition: rpl_context.h:37
uint32 len
Definition: replication.h:697
enum_tx_isolation tx_isolation
Definition: replication.h:113
before_recovery_t before_recovery
Definition: replication.h:377
Binlog_storage_flags
Binlog storage flags.
Definition: replication.h:294
Binlog_cache_storage * trx_cache_log
Definition: replication.h:155
after_sync_t after_sync
Definition: replication.h:416
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:1000
void init()
Definition: rpl_group_replication.cc:60
int(* before_recovery_t)(Server_state_param *param)
This callback is called before the start of the recovery.
Definition: replication.h:323
const char * p
Definition: ctype-mb.cc:1232
before_handle_connection_t before_handle_connection
Definition: replication.h:376
ulonglong cache_log_max_size
Definition: replication.h:157
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:963
int unregister_trans_observer(Trans_observer *observer, void *p)
Unregister a transaction observer.
Definition: rpl_handler.cc:959
char * user
Definition: replication.h:573
Definition: mysql.h:294
int unregister_server_state_observer(Server_state_observer *observer, void *p)
Unregister a server state observer.
Definition: rpl_handler.cc:984
char * channel_name
Definition: replication.h:569
Byte container that provides a storage for serializing session binlog events.
Definition: binlog_ostream.h:172
applier_stop_t applier_stop
Definition: replication.h:702
int(* transmit_stop_t)(Binlog_transmit_param *param)
This callback is called when binlog dumping stops.
Definition: replication.h:464
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:990
int(* before_rollback_t)(Trans_param *param)
This callback is called before transaction rollback.
Definition: replication.h:226
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:701
uint64 * original_commit_timestamp
pointer to the status var original_commit_timestamp
Definition: replication.h:177
Trans_gtid_info gtid_info
Definition: replication.h:150
before_commit_t before_commit
Definition: replication.h:284
int(* after_rollback_t)(Trans_param *param)
This callback is called after transaction rollback.
Definition: replication.h:264
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:679
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:600
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:501
int register_server_state_observer(Server_state_observer *observer, void *p)
Register a server state observer.
Definition: rpl_handler.cc:976
long long int gno
Definition: replication.h:124
unsigned long ulong
Definition: my_inttypes.h:48
enum_tx_isolation
Definition: handler.h:2593
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:704
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:336
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:777
int(* after_reset_master_t)(Binlog_transmit_param *param)
This callback is called after resetting master status.
Definition: replication.h:537
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:579
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.