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