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