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