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