MySQL  8.0.19
Source Code Documentation
group_replication_priv.h
Go to the documentation of this file.
1 /* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef GROUP_REPLICATION_PRIV_INCLUDE
24 #define GROUP_REPLICATION_PRIV_INCLUDE
25 
26 /**
27  @file include/mysql/group_replication_priv.h
28 */
29 
30 #include "my_sys.h"
31 #include "my_thread.h"
32 #include "sql/binlog_ostream.h"
33 #include "sql/binlog_reader.h"
34 #include "sql/debug_sync.h"
35 #include "sql/log_event.h"
36 #include "sql/replication.h"
38 #include "sql/rpl_gtid.h"
40 
41 /**
42  Server side initializations.
43 */
45 
46 /**
47  Returns the server connection attribute
48 
49  @note This method implementation is on sql_class.cc
50 
51  @return the pthread for the connection attribute.
52 */
54 
55 /**
56  Returns the server hostname, port and uuid.
57 
58  @param[out] hostname
59  @param[out] port
60  @param[out] uuid
61  @param[out] server_version
62 */
63 void get_server_parameters(char **hostname, uint *port, char **uuid,
64  unsigned int *server_version);
65 
66 /**
67  Returns the server ssl configuration values.
68 
69  @param[out] server_ssl_variables
70 */
71 void get_server_ssl_parameters(st_server_ssl_variables *server_ssl_variables);
72 
73 /**
74  Returns the server_id.
75 
76  @return server_id
77 */
79 
80 /**
81  Returns the server auto_increment_increment
82 
83  @return auto_increment_increment
84 */
86 
87 /**
88  Returns the server auto_increment_offset
89 
90  @return auto_increment_offset
91 */
93 
94 /**
95  Set server auto_increment_increment
96 
97  @param[in] auto_increment_increment
98 */
99 void set_auto_increment_increment(ulong auto_increment_increment);
100 
101 /**
102  Set server auto_increment_offset
103 
104  @param[in] auto_increment_offset
105 */
106 void set_auto_increment_offset(ulong auto_increment_offset);
107 
108 /**
109  Returns a struct containing all server startup information needed to evaluate
110  if one has conditions to proceed executing master-master replication.
111 
112  @param[out] requirements
113 
114  @param[in] has_lock Caller should set this to true if the calling
115  thread holds gtid_mode_lock; otherwise set it to false.
116 */
118  bool has_lock);
119 
120 /**
121  Returns the server GTID_EXECUTED encoded as a binary string.
122 
123  @note Memory allocated to encoded_gtid_executed must be release by caller.
124 
125  @param[out] encoded_gtid_executed binary string
126  @param[out] length binary string length
127 */
128 bool get_server_encoded_gtid_executed(uchar **encoded_gtid_executed,
129  size_t *length);
130 
131 #if !defined(DBUG_OFF)
132 /**
133  Returns a text representation of a encoded GTID set.
134 
135  @note Memory allocated to returned pointer must be release by caller.
136 
137  @param[in] encoded_gtid_set binary string
138  @param[in] length binary string length
139 
140  @return a pointer to text representation of the encoded set
141 */
142 char *encoded_gtid_set_to_string(uchar *encoded_gtid_set, size_t length);
143 #endif
144 
145 /**
146  Return last gno for a given sidno, see
147  Gtid_state::get_last_executed_gno() for details.
148 */
150 
151 /**
152  Return sidno for a given sid, see Sid_map::add_sid() for details.
153 */
155 
156 /**
157  Set slave thread default options.
158 
159  @param[in] thd The thread
160 */
161 void set_slave_thread_options(THD *thd);
162 
163 /**
164  Add thread to Global_THD_manager singleton.
165 
166  @param[in] thd The thread
167 */
169 
170 /**
171  Remove thread from Global_THD_manager singleton.
172 
173  @param[in] thd The thread
174 */
176 
177 /**
178  Function that returns the write set extraction algorithm name.
179 
180  @param[in] algorithm The algorithm value
181 
182  @return the algorithm name
183 */
184 const char *get_write_set_algorithm_string(unsigned int algorithm);
185 
186 /**
187  Returns true if the given transaction is committed.
188 
189  @param[in] gtid The transaction identifier
190 
191  @return true the transaction is committed
192  false otherwise
193 */
194 bool is_gtid_committed(const Gtid &gtid);
195 
196 /**
197  Returns the value of slave_max_allowed_packet.
198 
199  @return slave_max_allowed_packet
200 */
201 unsigned long get_slave_max_allowed_packet();
202 
203 /**
204  @returns the maximum value of slave_max_allowed_packet.
205  */
206 unsigned long get_max_slave_max_allowed_packet();
207 
208 /**
209  @returns if the server is restarting after a clone
210 */
212 
213 #endif /* GROUP_REPLICATION_PRIV_INCLUDE */
is_gtid_committed
bool is_gtid_committed(const Gtid &gtid)
Returns true if the given transaction is committed.
Definition: rpl_group_replication.cc:442
THD
Definition: sql_class.h:764
get_connection_attrib
my_thread_attr_t * get_connection_attrib()
Returns the server connection attribute.
Definition: sql_thd_api.cc:280
get_server_id
ulong get_server_id()
Returns the server_id.
Definition: rpl_group_replication.cc:360
Gtid
TODO: Move this structure to libbinlogevents/include/control_events.h when we start using C++11.
Definition: rpl_gtid.h:925
my_thread_attr_t
pthread_attr_t my_thread_attr_t
Definition: my_thread_bits.h:48
is_server_restarting_after_clone
bool is_server_restarting_after_clone()
Definition: rpl_group_replication.cc:462
get_server_startup_prerequirements
void get_server_startup_prerequirements(Trans_context_info &requirements, bool has_lock)
Returns a struct containing all server startup information needed to evaluate if one has conditions t...
Definition: rpl_group_replication.cc:378
get_slave_max_allowed_packet
unsigned long get_slave_max_allowed_packet()
Returns the value of slave_max_allowed_packet.
Definition: rpl_group_replication.cc:454
get_max_slave_max_allowed_packet
unsigned long get_max_slave_max_allowed_packet()
Definition: rpl_group_replication.cc:458
server_version
static char * server_version
Definition: mysql.cc:107
rpl_sidno
int rpl_sidno
Type of SIDNO (source ID number, first component of GTID)
Definition: rpl_gtid.h:94
my_thread.h
get_server_encoded_gtid_executed
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:399
get_server_ssl_parameters
void get_server_ssl_parameters(st_server_ssl_variables *server_ssl_variables)
Returns the server ssl configuration values.
Definition: rpl_group_replication.cc:334
get_auto_increment_increment
ulong get_auto_increment_increment()
Returns the server auto_increment_increment.
Definition: rpl_group_replication.cc:362
encoded_gtid_set_to_string
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:420
global_thd_manager_remove_thd
void global_thd_manager_remove_thd(THD *thd)
Remove thread from Global_THD_manager singleton.
Definition: rpl_group_replication.cc:438
get_sidno_from_global_sid_map
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:257
binlog_reader.h
get_write_set_algorithm_string
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:60
log_event.h
Binary log event definitions. This includes generic code common to all types of log events,...
set_auto_increment_increment
void set_auto_increment_increment(ulong auto_increment_increment)
Set server auto_increment_increment.
Definition: rpl_group_replication.cc:370
get_auto_increment_offset
ulong get_auto_increment_offset()
Returns the server auto_increment_offset.
Definition: rpl_group_replication.cc:366
rpl_write_set_handler.h
rpl_channel_service_interface.h
uint
unsigned int uint
Definition: uca-dump.cc:29
rpl_gno
long long int rpl_gno
Type of GNO, the second (numeric) component of GTID.
Definition: rpl_gtid.h:100
port
static in_port_t port
Definition: testapp.c:33
get_server_parameters
void get_server_parameters(char **hostname, uint *port, char **uuid, unsigned int *server_version)
Returns the server hostname, port and uuid.
Definition: rpl_group_replication.cc:285
uchar
unsigned char uchar
Definition: my_inttypes.h:51
set_auto_increment_offset
void set_auto_increment_offset(ulong auto_increment_offset)
Set server auto_increment_offset.
Definition: rpl_group_replication.cc:374
replication.h
get_last_executed_gno
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:267
Trans_context_info
This represents some of the context in which a transaction is running It summarizes all necessary req...
Definition: replication.h:99
binlog_ostream.h
debug_sync.h
global_thd_manager_add_thd
void global_thd_manager_add_thd(THD *thd)
Add thread to Global_THD_manager singleton.
Definition: rpl_group_replication.cc:434
gis::length
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:75
group_replication_init
int group_replication_init()
Server side initializations.
Definition: rpl_group_replication.cc:98
ulong
unsigned long ulong
Definition: my_inttypes.h:48
st_server_ssl_variables
Struct to share server ssl variables.
Definition: replication.h:47
set_slave_thread_options
void set_slave_thread_options(THD *thd)
Set slave thread default options.
Definition: rpl_slave.cc:3814
binary_log::Uuid
Definition: uuid.h:60
rpl_gtid.h
my_sys.h