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