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