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