MySQL 8.0.40
Source Code Documentation
group_replication_priv.h
Go to the documentation of this file.
1/* Copyright (c) 2015, 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 GROUP_REPLICATION_PRIV_INCLUDE
25#define GROUP_REPLICATION_PRIV_INCLUDE
26
27/**
28 @file include/mysql/group_replication_priv.h
29*/
30
31#include "my_sys.h"
32#include "my_thread.h"
34#include "sql/binlog_ostream.h"
35#include "sql/binlog_reader.h"
36#include "sql/debug_sync.h"
37#include "sql/log_event.h"
38#include "sql/replication.h"
41#include "sql/rpl_gtid.h"
43
44/**
45 Server side initializations.
46*/
48
49/**
50 Returns the server connection attribute
51
52 @note This method implementation is on sql_class.cc
53
54 @return the pthread for the connection attribute.
55*/
57
58/**
59 Returns the server hostname, port and uuid.
60
61 @param[out] hostname hostname
62 @param[out] port port
63 @param[out] uuid uuid
64 @param[out] server_version server version
65 @param[out] admin_port mysqld admin port
66*/
67void get_server_parameters(char **hostname, uint *port, char **uuid,
68 unsigned int *server_version, uint *admin_port);
69
70/**
71 Returns the server's client-server interface's ssl configuration values.
72
73 @param[out] server_ssl_variables server's ssl_variables
74*/
76 st_server_ssl_variables *server_ssl_variables);
77
78/**
79 Returns the server's admin interface's ssl configuration values.
80
81 @param[out] server_ssl_variables server's ssl_variables
82*/
84 st_server_ssl_variables *server_ssl_variables);
85
86/**
87 Returns the server_id.
88
89 @return server_id
90*/
91ulong get_server_id();
92
93/**
94 Returns the server auto_increment_increment
95
96 @return auto_increment_increment
97*/
99
100/**
101 Returns the server auto_increment_offset
102
103 @return auto_increment_offset
104*/
106
107/**
108 Set server auto_increment_increment
109
110 @param[in] auto_increment_increment auto-increment increment
111*/
112void set_auto_increment_increment(ulong auto_increment_increment);
113
114/**
115 Set server auto_increment_offset
116
117 @param[in] auto_increment_offset auto-increment offset
118*/
119void set_auto_increment_offset(ulong auto_increment_offset);
120
121/**
122 Returns a struct containing all server startup information needed to evaluate
123 if one has conditions to proceed executing master-master replication.
124
125 @param[out] requirements requirements
126*/
128
129/**
130 Returns the server GTID_EXECUTED encoded as a binary string.
131
132 @note Memory allocated to encoded_gtid_executed must be release by caller.
133
134 @param[out] encoded_gtid_executed binary string
135 @param[out] length binary string length
136*/
137bool get_server_encoded_gtid_executed(uchar **encoded_gtid_executed,
138 size_t *length);
139
140#if !defined(NDEBUG)
141/**
142 Returns a text representation of a encoded GTID set.
143
144 @note Memory allocated to returned pointer must be release by caller.
145
146 @param[in] encoded_gtid_set binary string
147 @param[in] length binary string length
148
149 @return a pointer to text representation of the encoded set
150*/
151char *encoded_gtid_set_to_string(uchar *encoded_gtid_set, size_t length);
152#endif
153
154/**
155 Return last gno for a given sidno, see
156 Gtid_state::get_last_executed_gno() for details.
157*/
159
160/**
161 Return sidno for a given sid, see Sid_map::add_sid() for details.
162*/
164
165/**
166 Set slave thread default options.
167
168 @param[in] thd The thread
169*/
171
172/**
173 Add thread to Global_THD_manager singleton.
174
175 @param[in] thd The thread
176*/
178
179/**
180 Remove thread from Global_THD_manager singleton.
181
182 @param[in] thd The thread
183*/
185
186/**
187 Function that returns the write set extraction algorithm name.
188
189 @param[in] algorithm The algorithm value
190
191 @return the algorithm name
192*/
193const char *get_write_set_algorithm_string(unsigned int algorithm);
194
195/**
196 Returns true if the given transaction is committed.
197
198 @param[in] gtid The transaction identifier
199
200 @return true the transaction is committed
201 false otherwise
202*/
203bool is_gtid_committed(const Gtid &gtid);
204
205/**
206 Returns the value of replica_max_allowed_packet.
207
208 @return replica_max_allowed_packet
209*/
210unsigned long get_replica_max_allowed_packet();
211
212/**
213 Wait until the given Gtid_set is included in @@GLOBAL.GTID_EXECUTED.
214
215 @param[in] gtid_set_text Gtid_set to wait for.
216 @param[in] timeout The maximum number of seconds that the
217 function should wait, or 0 to wait indefinitely.
218 @param[in] update_thd_status
219 when true updates the stage info with
220 the new wait condition, when false keeps the
221 current stage info.
222
223 @retval false the Gtid_set is included in @@GLOBAL.GTID_EXECUTED
224 @retval true otherwise
225*/
226bool wait_for_gtid_set_committed(const char *gtid_set_text, double timeout,
227 bool update_thd_status);
228
229/**
230 @returns the maximum value of replica_max_allowed_packet.
231 */
233
234/**
235 @returns if the server is restarting after a clone
236*/
238
239/**
240 @returns if the server already dropped its data when cloning
241*/
243
244#endif /* GROUP_REPLICATION_PRIV_INCLUDE */
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
Declarations for the Debug Sync Facility.
void set_slave_thread_options(THD *thd)
Set slave thread default options.
Definition: rpl_replica.cc:3981
rpl_gno get_last_executed_gno(rpl_sidno sidno)
Return last gno for a given sidno, see Gtid_state::get_last_executed_gno() for details.
Definition: rpl_gtid_misc.cc:227
void get_server_admin_ssl_parameters(st_server_ssl_variables *server_ssl_variables)
Returns the server's admin interface's ssl configuration values.
Definition: rpl_group_replication.cc:446
bool wait_for_gtid_set_committed(const char *gtid_set_text, double timeout, bool update_thd_status)
Wait until the given Gtid_set is included in @GLOBAL.GTID_EXECUTED.
Definition: rpl_group_replication.cc:557
ulong get_server_id()
Returns the server_id.
Definition: rpl_group_replication.cc:469
ulong get_auto_increment_increment()
Returns the server auto_increment_increment.
Definition: rpl_group_replication.cc:471
void get_server_startup_prerequirements(Trans_context_info &requirements)
Returns a struct containing all server startup information needed to evaluate if one has conditions t...
Definition: rpl_group_replication.cc:487
void get_server_parameters(char **hostname, uint *port, char **uuid, unsigned int *server_version, uint *admin_port)
Returns the server hostname, port and uuid.
Definition: rpl_group_replication.cc:371
rpl_sidno get_sidno_from_global_sid_map(rpl_sid sid)
Return sidno for a given sid, see Sid_map::add_sid() for details.
Definition: rpl_gtid_misc.cc:217
bool is_server_data_dropped()
Definition: rpl_group_replication.cc:600
void get_server_main_ssl_parameters(st_server_ssl_variables *server_ssl_variables)
Returns the server's client-server interface's ssl configuration values.
Definition: rpl_group_replication.cc:423
bool is_server_restarting_after_clone()
Definition: rpl_group_replication.cc:598
int group_replication_init()
Server side initializations.
Definition: rpl_group_replication.cc:110
void global_thd_manager_add_thd(THD *thd)
Add thread to Global_THD_manager singleton.
Definition: rpl_group_replication.cc:537
ulong get_auto_increment_offset()
Returns the server auto_increment_offset.
Definition: rpl_group_replication.cc:475
void global_thd_manager_remove_thd(THD *thd)
Remove thread from Global_THD_manager singleton.
Definition: rpl_group_replication.cc:541
bool is_gtid_committed(const Gtid &gtid)
Returns true if the given transaction is committed.
Definition: rpl_group_replication.cc:545
bool get_server_encoded_gtid_executed(uchar **encoded_gtid_executed, size_t *length)
Returns the server GTID_EXECUTED encoded as a binary string.
Definition: rpl_group_replication.cc:506
unsigned long get_replica_max_allowed_packet()
Returns the value of replica_max_allowed_packet.
Definition: rpl_group_replication.cc:590
const char * get_write_set_algorithm_string(unsigned int algorithm)
Function that returns the write set extraction algorithm name.
Definition: rpl_write_set_handler.cc:61
void set_auto_increment_offset(ulong auto_increment_offset)
Set server auto_increment_offset.
Definition: rpl_group_replication.cc:483
my_thread_attr_t * get_connection_attrib()
Returns the server connection attribute.
Definition: sql_thd_api.cc:293
unsigned long get_max_replica_max_allowed_packet()
Definition: rpl_group_replication.cc:594
char * encoded_gtid_set_to_string(uchar *encoded_gtid_set, size_t length)
Returns a text representation of a encoded GTID set.
Definition: rpl_group_replication.cc:523
void set_auto_increment_increment(ulong auto_increment_increment)
Set server auto_increment_increment.
Definition: rpl_group_replication.cc:479
Binary log event definitions.
unsigned char uchar
Definition: my_inttypes.h:52
Common header for many mysys elements.
Defines to make different thread packages compatible.
pthread_attr_t my_thread_attr_t
Definition: my_thread_bits.h:49
static char * server_version
Definition: mysql.cc:109
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
static bool timeout(bool(*wait_condition)())
Timeout function.
Definition: log0meb.cc:496
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:33
int rpl_sidno
Type of SIDNO (source ID number, first component of GTID)
Definition: rpl_gtid.h:96
binary_log::gtids::gno_t rpl_gno
GNO, the second (numeric) component of a GTID, is an alias of binary_log::gtids::gno_t.
Definition: rpl_gtid.h:103
TODO: Move this structure to libbinlogevents/include/control_events.h when we start using C++11.
Definition: rpl_gtid.h:1066
This represents some of the context in which a transaction is running It summarizes all necessary req...
Definition: replication.h:99
This is a POD.
Definition: uuid.h:61
Struct to share server ssl variables.
Definition: replication.h:48
unsigned int uint
Definition: uca9-dump.cc:75