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