/src/server/include/mysql/plugin.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* Copyright (c) 2005, 2013, Oracle and/or its affiliates |
2 | | Copyright (C) 2009, 2017, MariaDB |
3 | | |
4 | | This program is free software; you can redistribute it and/or modify |
5 | | it under the terms of the GNU General Public License as published by |
6 | | the Free Software Foundation; version 2 of the License. |
7 | | |
8 | | This program is distributed in the hope that it will be useful, |
9 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | | GNU General Public License for more details. |
12 | | |
13 | | You should have received a copy of the GNU General Public License |
14 | | along with this program; if not, write to the Free Software |
15 | | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ |
16 | | |
17 | | /** |
18 | | @file |
19 | | |
20 | | Interfaces for creating server and client plugins. |
21 | | */ |
22 | | |
23 | | #ifndef MYSQL_PLUGIN_INCLUDED |
24 | | #define MYSQL_PLUGIN_INCLUDED |
25 | | |
26 | | /* |
27 | | On Windows, exports from DLL need to be declared |
28 | | Also, plugin needs to be declared as extern "C" because MSVC |
29 | | unlike other compilers, uses C++ mangling for variables not only |
30 | | for functions. |
31 | | */ |
32 | | #ifdef MYSQL_DYNAMIC_PLUGIN |
33 | | #ifdef _MSC_VER |
34 | | #define MYSQL_DLLEXPORT _declspec(dllexport) |
35 | | #else |
36 | | #define MYSQL_DLLEXPORT |
37 | | #endif |
38 | | #else |
39 | | #define MYSQL_DLLEXPORT |
40 | | #endif |
41 | | |
42 | | #ifdef __cplusplus |
43 | | #define MYSQL_PLUGIN_EXPORT extern "C" MYSQL_DLLEXPORT |
44 | | #else |
45 | | #define MYSQL_PLUGIN_EXPORT MYSQL_DLLEXPORT |
46 | | #endif |
47 | | |
48 | | #ifdef __cplusplus |
49 | | class THD; |
50 | | class Item; |
51 | | #define MYSQL_THD THD* |
52 | | #else |
53 | | #define MYSQL_THD void* |
54 | | #endif |
55 | | |
56 | | typedef char my_bool; |
57 | | typedef void * MYSQL_PLUGIN; |
58 | | |
59 | | #include <mysql/services.h> |
60 | | |
61 | | #define MYSQL_XIDDATASIZE 128 |
62 | | /** |
63 | | struct st_mysql_xid is binary compatible with the XID structure as |
64 | | in the X/Open CAE Specification, Distributed Transaction Processing: |
65 | | The XA Specification, X/Open Company Ltd., 1991. |
66 | | http://www.opengroup.org/bookstore/catalog/c193.htm |
67 | | |
68 | | @see XID in sql/handler.h |
69 | | */ |
70 | | struct st_mysql_xid { |
71 | | long formatID; |
72 | | long gtrid_length; |
73 | | long bqual_length; |
74 | | char data[MYSQL_XIDDATASIZE]; /* Not \0-terminated */ |
75 | | }; |
76 | | typedef struct st_mysql_xid MYSQL_XID; |
77 | | |
78 | | /************************************************************************* |
79 | | Plugin API. Common for all plugin types. |
80 | | */ |
81 | | |
82 | | /** MySQL plugin interface version */ |
83 | | #define MYSQL_PLUGIN_INTERFACE_VERSION 0x0104 |
84 | | |
85 | | /** MariaDB plugin interface version */ |
86 | | #define MARIA_PLUGIN_INTERFACE_VERSION 0x010f |
87 | | |
88 | | /* |
89 | | The allowable types of plugins |
90 | | */ |
91 | | #define MYSQL_UDF_PLUGIN 0 /**< not implemented */ |
92 | | #define MYSQL_STORAGE_ENGINE_PLUGIN 1 |
93 | | #define MYSQL_FTPARSER_PLUGIN 2 /**< Full-text parser plugin */ |
94 | | #define MYSQL_DAEMON_PLUGIN 3 |
95 | | #define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 |
96 | | #define MYSQL_AUDIT_PLUGIN 5 |
97 | | #define MYSQL_REPLICATION_PLUGIN 6 |
98 | | #define MYSQL_AUTHENTICATION_PLUGIN 7 |
99 | | #define MYSQL_MAX_PLUGIN_TYPE_NUM 12 /**< The number of plugin types */ |
100 | | |
101 | | /* MariaDB plugin types */ |
102 | | /** Client and server password validation */ |
103 | | #define MariaDB_PASSWORD_VALIDATION_PLUGIN 8 |
104 | | /**< Encryption and key managment plugins */ |
105 | | #define MariaDB_ENCRYPTION_PLUGIN 9 |
106 | | /**< Plugins for SQL data storage types */ |
107 | | #define MariaDB_DATA_TYPE_PLUGIN 10 |
108 | | /**< Plugins for new native SQL functions */ |
109 | | #define MariaDB_FUNCTION_PLUGIN 11 |
110 | | |
111 | | /* We use the following strings to define licenses for plugins */ |
112 | | #define PLUGIN_LICENSE_PROPRIETARY 0 |
113 | | #define PLUGIN_LICENSE_GPL 1 |
114 | | #define PLUGIN_LICENSE_BSD 2 |
115 | | |
116 | | #define PLUGIN_LICENSE_PROPRIETARY_STRING "PROPRIETARY" |
117 | | #define PLUGIN_LICENSE_GPL_STRING "GPL" |
118 | | #define PLUGIN_LICENSE_BSD_STRING "BSD" |
119 | | |
120 | | /* definitions of code maturity for plugins */ |
121 | | #define MariaDB_PLUGIN_MATURITY_UNKNOWN 0 |
122 | | #define MariaDB_PLUGIN_MATURITY_EXPERIMENTAL 1 |
123 | | #define MariaDB_PLUGIN_MATURITY_ALPHA 2 |
124 | | #define MariaDB_PLUGIN_MATURITY_BETA 3 |
125 | | #define MariaDB_PLUGIN_MATURITY_GAMMA 4 |
126 | | #define MariaDB_PLUGIN_MATURITY_STABLE 5 |
127 | | |
128 | | /* |
129 | | Macros for beginning and ending plugin declarations. Between |
130 | | mysql_declare_plugin and mysql_declare_plugin_end there should |
131 | | be a st_mysql_plugin struct for each plugin to be declared. |
132 | | */ |
133 | | |
134 | | |
135 | | #ifndef MYSQL_DYNAMIC_PLUGIN |
136 | | #define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \ |
137 | | int VERSION= MYSQL_PLUGIN_INTERFACE_VERSION; \ |
138 | | int PSIZE= sizeof(struct st_mysql_plugin); \ |
139 | | struct st_mysql_plugin DECLS[]= { |
140 | | |
141 | | #define MARIA_DECLARE_PLUGIN__(NAME, VERSION, PSIZE, DECLS) \ |
142 | | MYSQL_PLUGIN_EXPORT int VERSION; \ |
143 | | int VERSION= MARIA_PLUGIN_INTERFACE_VERSION; \ |
144 | | MYSQL_PLUGIN_EXPORT int PSIZE; \ |
145 | | int PSIZE= sizeof(struct st_maria_plugin); \ |
146 | | MYSQL_PLUGIN_EXPORT struct st_maria_plugin DECLS[]; \ |
147 | | struct st_maria_plugin DECLS[]= { |
148 | | #else |
149 | | |
150 | | #define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \ |
151 | | MYSQL_PLUGIN_EXPORT int _mysql_plugin_interface_version_; \ |
152 | | int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION; \ |
153 | | MYSQL_PLUGIN_EXPORT int _mysql_sizeof_struct_st_plugin_; \ |
154 | | int _mysql_sizeof_struct_st_plugin_= sizeof(struct st_mysql_plugin); \ |
155 | | MYSQL_PLUGIN_EXPORT struct st_mysql_plugin _mysql_plugin_declarations_[]; \ |
156 | | struct st_mysql_plugin _mysql_plugin_declarations_[]= { |
157 | | |
158 | | #define MARIA_DECLARE_PLUGIN__(NAME, VERSION, PSIZE, DECLS) \ |
159 | | MYSQL_PLUGIN_EXPORT int _maria_plugin_interface_version_; \ |
160 | | int _maria_plugin_interface_version_= MARIA_PLUGIN_INTERFACE_VERSION; \ |
161 | | MYSQL_PLUGIN_EXPORT int _maria_sizeof_struct_st_plugin_; \ |
162 | | int _maria_sizeof_struct_st_plugin_= sizeof(struct st_maria_plugin); \ |
163 | | MYSQL_PLUGIN_EXPORT struct st_maria_plugin _maria_plugin_declarations_[]; \ |
164 | | struct st_maria_plugin _maria_plugin_declarations_[]= { |
165 | | |
166 | | #endif |
167 | | |
168 | | #define mysql_declare_plugin(NAME) \ |
169 | | __MYSQL_DECLARE_PLUGIN(NAME, \ |
170 | | builtin_ ## NAME ## _plugin_interface_version, \ |
171 | | builtin_ ## NAME ## _sizeof_struct_st_plugin, \ |
172 | | builtin_ ## NAME ## _plugin) |
173 | | |
174 | | #define maria_declare_plugin(NAME) \ |
175 | | MARIA_DECLARE_PLUGIN__(NAME, \ |
176 | | builtin_maria_ ## NAME ## _plugin_interface_version, \ |
177 | | builtin_maria_ ## NAME ## _sizeof_struct_st_plugin, \ |
178 | | builtin_maria_ ## NAME ## _plugin) |
179 | | |
180 | | #define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0,0}} |
181 | | #define maria_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0,0}} |
182 | | |
183 | | /* |
184 | | declarations for SHOW STATUS support in plugins |
185 | | */ |
186 | | enum enum_mysql_show_type |
187 | | { |
188 | | SHOW_UNDEF, SHOW_BOOL, SHOW_UINT, SHOW_ULONG, |
189 | | SHOW_ULONGLONG, SHOW_CHAR, SHOW_CHAR_PTR, |
190 | | SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE, |
191 | | SHOW_SINT, SHOW_SLONG, SHOW_SLONGLONG, SHOW_SIMPLE_FUNC, |
192 | | SHOW_SIZE_T, SHOW_always_last |
193 | | }; |
194 | | |
195 | | /* backward compatibility mapping. */ |
196 | | #define SHOW_INT SHOW_UINT |
197 | | #define SHOW_LONG SHOW_ULONG |
198 | | #define SHOW_LONGLONG SHOW_ULONGLONG |
199 | | |
200 | | enum enum_var_type |
201 | | { |
202 | | SHOW_OPT_DEFAULT= 0, SHOW_OPT_SESSION, SHOW_OPT_GLOBAL |
203 | | }; |
204 | | |
205 | | struct st_mysql_show_var { |
206 | | const char *name; |
207 | | void *value; |
208 | | enum enum_mysql_show_type type; |
209 | | }; |
210 | | |
211 | | struct system_status_var; |
212 | | |
213 | | #define SHOW_VAR_FUNC_BUFF_SIZE (256 * sizeof(void*)) |
214 | | typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type); |
215 | | |
216 | | |
217 | | static inline |
218 | | struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name, |
219 | | mysql_show_var_func func_arg) |
220 | 0 | { |
221 | 0 | struct st_mysql_show_var tmp; |
222 | 0 | tmp.name= name; |
223 | 0 | tmp.value= (void*) func_arg; |
224 | 0 | tmp.type= SHOW_FUNC; |
225 | 0 | return tmp; |
226 | 0 | }; Unexecuted instantiation: fuzz_json.c:SHOW_FUNC_ENTRY Unexecuted instantiation: json_lib.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-ucs2.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-utf8.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype.c:SHOW_FUNC_ENTRY Unexecuted instantiation: dtoa.c:SHOW_FUNC_ENTRY Unexecuted instantiation: int2str.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-unidata.c:SHOW_FUNC_ENTRY Unexecuted instantiation: xml.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-mb.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-simple.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-uca.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_strtoll10.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_vsnprintf.c:SHOW_FUNC_ENTRY Unexecuted instantiation: strfill.c:SHOW_FUNC_ENTRY Unexecuted instantiation: strmake.c:SHOW_FUNC_ENTRY Unexecuted instantiation: strnmov.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-bin.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-latin1.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_malloc.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_static.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_thr_init.c:SHOW_FUNC_ENTRY Unexecuted instantiation: thr_mutex.c:SHOW_FUNC_ENTRY Unexecuted instantiation: thr_rwlock.c:SHOW_FUNC_ENTRY Unexecuted instantiation: psi_noop.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_error.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_getsystime.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_init.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_mess.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_once.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_symlink.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_sync.c:SHOW_FUNC_ENTRY Unexecuted instantiation: charset.c:SHOW_FUNC_ENTRY Unexecuted instantiation: errors.c:SHOW_FUNC_ENTRY Unexecuted instantiation: hash.c:SHOW_FUNC_ENTRY Unexecuted instantiation: mf_dirname.c:SHOW_FUNC_ENTRY Unexecuted instantiation: mf_loadpath.c:SHOW_FUNC_ENTRY Unexecuted instantiation: mf_pack.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_div.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_getwd.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_lib.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_open.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_read.c:SHOW_FUNC_ENTRY Unexecuted instantiation: array.c:SHOW_FUNC_ENTRY Unexecuted instantiation: charset-def.c:SHOW_FUNC_ENTRY Unexecuted instantiation: mf_qsort.c:SHOW_FUNC_ENTRY Unexecuted instantiation: my_alloc.c:SHOW_FUNC_ENTRY Unexecuted instantiation: bchange.c:SHOW_FUNC_ENTRY Unexecuted instantiation: bmove_upp.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-big5.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-cp932.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-czech.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-euc_kr.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-eucjpms.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-extra.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-gb2312.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-gbk.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-sjis.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-tis620.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-ujis.c:SHOW_FUNC_ENTRY Unexecuted instantiation: ctype-win1250ch.c:SHOW_FUNC_ENTRY Unexecuted instantiation: is_prefix.c:SHOW_FUNC_ENTRY Unexecuted instantiation: str2int.c:SHOW_FUNC_ENTRY Unexecuted instantiation: strend.c:SHOW_FUNC_ENTRY Unexecuted instantiation: strxmov.c:SHOW_FUNC_ENTRY Unexecuted instantiation: strxnmov.c:SHOW_FUNC_ENTRY Unexecuted instantiation: strmov_overlapp.c:SHOW_FUNC_ENTRY |
227 | | |
228 | | |
229 | | /* |
230 | | Constants for plugin flags. |
231 | | */ |
232 | | |
233 | | #define PLUGIN_OPT_NO_INSTALL 1UL /**< Not dynamically loadable */ |
234 | | #define PLUGIN_OPT_NO_UNINSTALL 2UL /**< Not dynamically unloadable */ |
235 | | |
236 | | |
237 | | /* |
238 | | declarations for server variables and command line options |
239 | | */ |
240 | | |
241 | | |
242 | | #define PLUGIN_VAR_BOOL 0x0001 |
243 | | #define PLUGIN_VAR_INT 0x0002 |
244 | | #define PLUGIN_VAR_LONG 0x0003 |
245 | | #define PLUGIN_VAR_LONGLONG 0x0004 |
246 | | #define PLUGIN_VAR_STR 0x0005 |
247 | | #define PLUGIN_VAR_ENUM 0x0006 |
248 | | #define PLUGIN_VAR_SET 0x0007 |
249 | | #define PLUGIN_VAR_DOUBLE 0x0008 |
250 | | #define PLUGIN_VAR_UNSIGNED 0x0080 |
251 | | #define PLUGIN_VAR_THDLOCAL 0x0100 /**< Variable is per-connection */ |
252 | | #define PLUGIN_VAR_READONLY 0x0200 /**< Server variable is read only */ |
253 | | #define PLUGIN_VAR_NOSYSVAR 0x0400 /**< Not a server variable */ |
254 | | #define PLUGIN_VAR_NOCMDOPT 0x0800 /**< Not a command line option */ |
255 | | #define PLUGIN_VAR_NOCMDARG 0x1000 /**< No argument for cmd line */ |
256 | | #define PLUGIN_VAR_RQCMDARG 0x0000 /**< Argument required for cmd line */ |
257 | | #define PLUGIN_VAR_OPCMDARG 0x2000 /**< Argument optional for cmd line */ |
258 | | #define PLUGIN_VAR_DEPRECATED 0x4000 /**< Server variable is deprecated */ |
259 | | #define PLUGIN_VAR_MEMALLOC 0x8000 /**< String needs memory allocated */ |
260 | | |
261 | | struct st_mysql_sys_var; |
262 | | struct st_mysql_value; |
263 | | |
264 | | /** |
265 | | SYNOPSIS |
266 | | (*mysql_var_check_func)() |
267 | | thd thread handle |
268 | | var dynamic variable being altered |
269 | | save pointer to temporary storage |
270 | | value user provided value |
271 | | RETURN |
272 | | 0 user provided value is OK and the update func may be called. |
273 | | any other value indicates error. |
274 | | |
275 | | This function should parse the user provided value and store in the |
276 | | provided temporary storage any data as required by the update func. |
277 | | There is sufficient space in the temporary storage to store a double. |
278 | | Note that the update func may not be called if any other error occurs |
279 | | so any memory allocated should be thread-local so that it may be freed |
280 | | automatically at the end of the statement. |
281 | | */ |
282 | | |
283 | | typedef int (*mysql_var_check_func)(MYSQL_THD thd, |
284 | | struct st_mysql_sys_var *var, |
285 | | void *save, struct st_mysql_value *value); |
286 | | |
287 | | /** |
288 | | SYNOPSIS |
289 | | (*mysql_var_update_func)() |
290 | | thd thread handle |
291 | | var dynamic variable being altered |
292 | | var_ptr pointer to dynamic variable |
293 | | save pointer to temporary storage |
294 | | RETURN |
295 | | NONE |
296 | | |
297 | | This function should use the validated value stored in the temporary store |
298 | | and persist it in the provided pointer to the dynamic variable. |
299 | | For example, strings may require memory to be allocated. |
300 | | */ |
301 | | typedef void (*mysql_var_update_func)(MYSQL_THD thd, |
302 | | struct st_mysql_sys_var *var, |
303 | | void *var_ptr, const void *save); |
304 | | |
305 | | |
306 | | /* the following declarations are for internal use only */ |
307 | | |
308 | | |
309 | | #define PLUGIN_VAR_MASK \ |
310 | | (PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | \ |
311 | | PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \ |
312 | | PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | \ |
313 | | PLUGIN_VAR_DEPRECATED | PLUGIN_VAR_MEMALLOC) |
314 | | |
315 | | #define MYSQL_PLUGIN_VAR_HEADER \ |
316 | | int flags; \ |
317 | | const char *name; \ |
318 | | const char *comment; \ |
319 | | mysql_var_check_func check; \ |
320 | | mysql_var_update_func update |
321 | | |
322 | | #define MYSQL_SYSVAR_NAME(name) mysql_sysvar_ ## name |
323 | | #define MYSQL_SYSVAR(name) \ |
324 | | ((struct st_mysql_sys_var *)&(MYSQL_SYSVAR_NAME(name))) |
325 | | |
326 | | /* |
327 | | for global variables, the value pointer is the first |
328 | | element after the header, the default value is the second. |
329 | | for thread variables, the value offset is the first |
330 | | element after the header, the default value is the second. |
331 | | */ |
332 | | |
333 | | |
334 | | #define DECLARE_MYSQL_SYSVAR_BASIC(name, type) struct { \ |
335 | | MYSQL_PLUGIN_VAR_HEADER; \ |
336 | | type *value; \ |
337 | | const type def_val; \ |
338 | | } MYSQL_SYSVAR_NAME(name) |
339 | | |
340 | | #define DECLARE_MYSQL_SYSVAR_CONST_BASIC(name, type) struct { \ |
341 | | MYSQL_PLUGIN_VAR_HEADER; \ |
342 | | const type *value; \ |
343 | | const type def_val; \ |
344 | | } MYSQL_SYSVAR_NAME(name) |
345 | | |
346 | | #define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \ |
347 | | MYSQL_PLUGIN_VAR_HEADER; \ |
348 | | type *value; type def_val; \ |
349 | | type min_val; type max_val; \ |
350 | | type blk_sz; \ |
351 | | } MYSQL_SYSVAR_NAME(name) |
352 | | |
353 | | #define DECLARE_MYSQL_SYSVAR_TYPELIB(name, type) struct { \ |
354 | | MYSQL_PLUGIN_VAR_HEADER; \ |
355 | | type *value; type def_val; \ |
356 | | TYPELIB *typelib; \ |
357 | | } MYSQL_SYSVAR_NAME(name) |
358 | | |
359 | | #define DECLARE_THDVAR_FUNC(type) \ |
360 | | type *(*resolve)(MYSQL_THD thd, int offset) |
361 | | |
362 | | #define DECLARE_MYSQL_THDVAR_BASIC(name, type) struct { \ |
363 | | MYSQL_PLUGIN_VAR_HEADER; \ |
364 | | int offset; \ |
365 | | const type def_val; \ |
366 | | DECLARE_THDVAR_FUNC(type); \ |
367 | | } MYSQL_SYSVAR_NAME(name) |
368 | | |
369 | | #define DECLARE_MYSQL_THDVAR_SIMPLE(name, type) struct { \ |
370 | | MYSQL_PLUGIN_VAR_HEADER; \ |
371 | | int offset; \ |
372 | | type def_val; type min_val; \ |
373 | | type max_val; type blk_sz; \ |
374 | | DECLARE_THDVAR_FUNC(type); \ |
375 | | } MYSQL_SYSVAR_NAME(name) |
376 | | |
377 | | #define DECLARE_MYSQL_THDVAR_TYPELIB(name, type) struct { \ |
378 | | MYSQL_PLUGIN_VAR_HEADER; \ |
379 | | int offset; \ |
380 | | const type def_val; \ |
381 | | DECLARE_THDVAR_FUNC(type); \ |
382 | | TYPELIB *typelib; \ |
383 | | } MYSQL_SYSVAR_NAME(name) |
384 | | |
385 | | |
386 | | /* |
387 | | the following declarations are for use by plugin implementors |
388 | | */ |
389 | | |
390 | | #define MYSQL_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \ |
391 | | DECLARE_MYSQL_SYSVAR_BASIC(name, char) = { \ |
392 | | PLUGIN_VAR_BOOL | ((opt) & PLUGIN_VAR_MASK), \ |
393 | | #name, comment, check, update, &varname, def} |
394 | | |
395 | | #define MYSQL_SYSVAR_STR(name, varname, opt, comment, check, update, def) \ |
396 | | DECLARE_MYSQL_SYSVAR_BASIC(name, char *) = { \ |
397 | | PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \ |
398 | | #name, comment, check, update, &varname, def} |
399 | | |
400 | | #define MYSQL_SYSVAR_CONST_STR(name, varname, opt, comment, check, update, def) \ |
401 | | DECLARE_MYSQL_SYSVAR_CONST_BASIC(name, char *) = { \ |
402 | | PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \ |
403 | | #name, comment, check, update, &varname, def} |
404 | | |
405 | | #define MYSQL_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \ |
406 | | DECLARE_MYSQL_SYSVAR_SIMPLE(name, int) = { \ |
407 | | PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \ |
408 | | #name, comment, check, update, &varname, def, min, max, blk } |
409 | | |
410 | | #define MYSQL_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \ |
411 | | DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned int) = { \ |
412 | | PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ |
413 | | #name, comment, check, update, &varname, def, min, max, blk } |
414 | | |
415 | | #define MYSQL_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \ |
416 | | DECLARE_MYSQL_SYSVAR_SIMPLE(name, long) = { \ |
417 | | PLUGIN_VAR_LONG | ((opt) & PLUGIN_VAR_MASK), \ |
418 | | #name, comment, check, update, &varname, def, min, max, blk } |
419 | | |
420 | | #define MYSQL_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \ |
421 | | DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long) = { \ |
422 | | PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ |
423 | | #name, comment, check, update, &varname, def, min, max, blk } |
424 | | |
425 | | #define MYSQL_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \ |
426 | | DECLARE_MYSQL_SYSVAR_SIMPLE(name, long long) = { \ |
427 | | PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \ |
428 | | #name, comment, check, update, &varname, def, min, max, blk } |
429 | | |
430 | | #define MYSQL_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \ |
431 | | DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long long) = { \ |
432 | | PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ |
433 | | #name, comment, check, update, &varname, def, min, max, blk } |
434 | | |
435 | | #define MYSQL_SYSVAR_UINT64_T(name, varname, opt, comment, check, update, def, min, max, blk) \ |
436 | | DECLARE_MYSQL_SYSVAR_SIMPLE(name, uint64_t) = { \ |
437 | | PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ |
438 | | #name, comment, check, update, &varname, def, min, max, blk } |
439 | | |
440 | | #ifdef _WIN64 |
441 | | #define MYSQL_SYSVAR_SIZE_T(name, varname, opt, comment, check, update, def, min, max, blk) \ |
442 | | DECLARE_MYSQL_SYSVAR_SIMPLE(name, size_t) = { \ |
443 | | PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ |
444 | | #name, comment, check, update, &varname, def, min, max, blk } |
445 | | #else |
446 | | #define MYSQL_SYSVAR_SIZE_T(name, varname, opt, comment, check, update, def, min, max, blk) \ |
447 | | DECLARE_MYSQL_SYSVAR_SIMPLE(name, size_t) = { \ |
448 | | PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ |
449 | | #name, comment, check, update, &varname, def, min, max, blk } |
450 | | #endif |
451 | | |
452 | | #define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \ |
453 | | DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \ |
454 | | PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \ |
455 | | #name, comment, check, update, &varname, def, typelib } |
456 | | |
457 | | #define MYSQL_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \ |
458 | | DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long long) = { \ |
459 | | PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \ |
460 | | #name, comment, check, update, &varname, def, typelib } |
461 | | |
462 | | #define MYSQL_SYSVAR_DOUBLE(name, varname, opt, comment, check, update, def, min, max, blk) \ |
463 | | DECLARE_MYSQL_SYSVAR_SIMPLE(name, double) = { \ |
464 | | PLUGIN_VAR_DOUBLE | ((opt) & PLUGIN_VAR_MASK), \ |
465 | | #name, comment, check, update, &varname, def, min, max, blk } |
466 | | |
467 | | #define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \ |
468 | | DECLARE_MYSQL_THDVAR_BASIC(name, char) = { \ |
469 | | PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ |
470 | | #name, comment, check, update, -1, def, NULL} |
471 | | |
472 | | #define MYSQL_THDVAR_STR(name, opt, comment, check, update, def) \ |
473 | | DECLARE_MYSQL_THDVAR_BASIC(name, char *) = { \ |
474 | | PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ |
475 | | #name, comment, check, update, -1, def, NULL} |
476 | | |
477 | | #define MYSQL_THDVAR_INT(name, opt, comment, check, update, def, min, max, blk) \ |
478 | | DECLARE_MYSQL_THDVAR_SIMPLE(name, int) = { \ |
479 | | PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ |
480 | | #name, comment, check, update, -1, def, min, max, blk, NULL } |
481 | | |
482 | | #define MYSQL_THDVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \ |
483 | | DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned int) = { \ |
484 | | PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ |
485 | | #name, comment, check, update, -1, def, min, max, blk, NULL } |
486 | | |
487 | | #define MYSQL_THDVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \ |
488 | | DECLARE_MYSQL_THDVAR_SIMPLE(name, long) = { \ |
489 | | PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ |
490 | | #name, comment, check, update, -1, def, min, max, blk, NULL } |
491 | | |
492 | | #define MYSQL_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \ |
493 | | DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long) = { \ |
494 | | PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ |
495 | | #name, comment, check, update, -1, def, min, max, blk, NULL } |
496 | | |
497 | | #define MYSQL_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \ |
498 | | DECLARE_MYSQL_THDVAR_SIMPLE(name, long long) = { \ |
499 | | PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ |
500 | | #name, comment, check, update, -1, def, min, max, blk, NULL } |
501 | | |
502 | | #define MYSQL_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \ |
503 | | DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long long) = { \ |
504 | | PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ |
505 | | #name, comment, check, update, -1, def, min, max, blk, NULL } |
506 | | |
507 | | #define MYSQL_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \ |
508 | | DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long) = { \ |
509 | | PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ |
510 | | #name, comment, check, update, -1, def, NULL, typelib } |
511 | | |
512 | | #define MYSQL_THDVAR_SET(name, opt, comment, check, update, def, typelib) \ |
513 | | DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long long) = { \ |
514 | | PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ |
515 | | #name, comment, check, update, -1, def, NULL, typelib } |
516 | | |
517 | | #define MYSQL_THDVAR_DOUBLE(name, opt, comment, check, update, def, min, max, blk) \ |
518 | | DECLARE_MYSQL_THDVAR_SIMPLE(name, double) = { \ |
519 | | PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ |
520 | | #name, comment, check, update, -1, def, min, max, blk, NULL } |
521 | | |
522 | | /* accessor macros */ |
523 | | |
524 | | #define SYSVAR(name) \ |
525 | | (*(MYSQL_SYSVAR_NAME(name).value)) |
526 | | |
527 | | /* when thd == null, result points to global value */ |
528 | | #define THDVAR(thd, name) \ |
529 | | (*(MYSQL_SYSVAR_NAME(name).resolve(thd, MYSQL_SYSVAR_NAME(name).offset))) |
530 | | |
531 | | |
532 | | /** |
533 | | Plugin description structure. |
534 | | */ |
535 | | |
536 | | struct st_mysql_plugin |
537 | | { |
538 | | int type; /**< the plugin type (a MYSQL_XXX_PLUGIN value) */ |
539 | | void *info; /**< pointer to type-specific plugin descriptor */ |
540 | | const char *name; /**< plugin name */ |
541 | | const char *author; /**< plugin author (for I_S.PLUGINS) */ |
542 | | const char *descr; /**< general descriptive text (for I_S.PLUGINS) */ |
543 | | int license; /**< the plugin license (PLUGIN_LICENSE_XXX) */ |
544 | | /** |
545 | | The function to invoke when plugin is loaded. Plugin |
546 | | initialisation done here should defer any ALTER TABLE queries to |
547 | | after the ddl recovery is done, in the signal_ddl_recovery_done() |
548 | | callback called by ha_signal_ddl_recovery_done(). |
549 | | */ |
550 | | int (*init)(void *); |
551 | | int (*deinit)(void *);/**< the function to invoke when plugin is unloaded */ |
552 | | unsigned int version; /**< plugin version (for I_S.PLUGINS) */ |
553 | | struct st_mysql_show_var *status_vars; |
554 | | struct st_mysql_sys_var **system_vars; |
555 | | void * __reserved1; /**< reserved for dependency checking */ |
556 | | unsigned long flags; /**< flags for plugin */ |
557 | | }; |
558 | | |
559 | | /** |
560 | | MariaDB extension for plugins declaration structure. |
561 | | |
562 | | It also copies current MySQL plugin fields to have more independency |
563 | | in plugins extension |
564 | | */ |
565 | | |
566 | | struct st_maria_plugin |
567 | | { |
568 | | int type; /**< the plugin type (a MYSQL_XXX_PLUGIN value) */ |
569 | | void *info; /**< pointer to type-specific plugin descriptor */ |
570 | | const char *name; /**< plugin name */ |
571 | | const char *author; /**< plugin author (for SHOW PLUGINS) */ |
572 | | const char *descr; /**< general descriptive text (for SHOW PLUGINS ) */ |
573 | | int license; /**< the plugin license (PLUGIN_LICENSE_XXX) */ |
574 | | /** |
575 | | The function to invoke when plugin is loaded. Plugin |
576 | | initialisation done here should defer any ALTER TABLE queries to |
577 | | after the ddl recovery is done, in the signal_ddl_recovery_done() |
578 | | callback called by ha_signal_ddl_recovery_done(). |
579 | | */ |
580 | | int (*init)(void *); |
581 | | int (*deinit)(void *);/**< the function to invoke when plugin is unloaded */ |
582 | | unsigned int version; /**< plugin version (for SHOW PLUGINS) */ |
583 | | struct st_mysql_show_var *status_vars; |
584 | | struct st_mysql_sys_var **system_vars; |
585 | | const char *version_info; /**< plugin version string */ |
586 | | unsigned int maturity; /**< MariaDB_PLUGIN_MATURITY_XXX */ |
587 | | }; |
588 | | |
589 | | /************************************************************************* |
590 | | API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN) |
591 | | */ |
592 | | #include "plugin_ftparser.h" |
593 | | |
594 | | /************************************************************************* |
595 | | API for Storage Engine plugin. (MYSQL_DAEMON_PLUGIN) |
596 | | */ |
597 | | |
598 | | /* handlertons of different MySQL releases are incompatible */ |
599 | | #define MYSQL_DAEMON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) |
600 | | |
601 | | /* |
602 | | Here we define only the descriptor structure, that is referred from |
603 | | st_mysql_plugin. |
604 | | */ |
605 | | |
606 | | struct st_mysql_daemon |
607 | | { |
608 | | int interface_version; |
609 | | }; |
610 | | |
611 | | |
612 | | /************************************************************************* |
613 | | API for I_S plugin. (MYSQL_INFORMATION_SCHEMA_PLUGIN) |
614 | | */ |
615 | | |
616 | | /* handlertons of different MySQL releases are incompatible */ |
617 | | #define MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) |
618 | | |
619 | | /* |
620 | | Here we define only the descriptor structure, that is referred from |
621 | | st_mysql_plugin. |
622 | | */ |
623 | | |
624 | | struct st_mysql_information_schema |
625 | | { |
626 | | int interface_version; |
627 | | }; |
628 | | |
629 | | |
630 | | /************************************************************************* |
631 | | API for Storage Engine plugin. (MYSQL_STORAGE_ENGINE_PLUGIN) |
632 | | */ |
633 | | |
634 | | /* handlertons of different MySQL releases are incompatible */ |
635 | | #define MYSQL_HANDLERTON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8) |
636 | | |
637 | | /* |
638 | | The real API is in the sql/handler.h |
639 | | Here we define only the descriptor structure, that is referred from |
640 | | st_mysql_plugin. |
641 | | */ |
642 | | |
643 | | struct st_mysql_storage_engine |
644 | | { |
645 | | int interface_version; |
646 | | }; |
647 | | |
648 | | struct handlerton; |
649 | | |
650 | | |
651 | | /* |
652 | | API for Replication plugin. (MYSQL_REPLICATION_PLUGIN) |
653 | | */ |
654 | | #define MYSQL_REPLICATION_INTERFACE_VERSION 0x0200 |
655 | | |
656 | | /** |
657 | | Replication plugin descriptor |
658 | | */ |
659 | | struct Mysql_replication { |
660 | | int interface_version; |
661 | | }; |
662 | | |
663 | | #define MYSQL_VALUE_TYPE_STRING 0 |
664 | | #define MYSQL_VALUE_TYPE_REAL 1 |
665 | | #define MYSQL_VALUE_TYPE_INT 2 |
666 | | |
667 | | /************************************************************************* |
668 | | st_mysql_value struct for reading values from mysqld. |
669 | | Used by server variables framework to parse user-provided values. |
670 | | Will be used for arguments when implementing UDFs. |
671 | | |
672 | | Note that val_str() returns a string in temporary memory |
673 | | that will be freed at the end of statement. Copy the string |
674 | | if you need it to persist. |
675 | | */ |
676 | | |
677 | | struct st_mysql_value |
678 | | { |
679 | | int (*value_type)(struct st_mysql_value *); |
680 | | const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length); |
681 | | int (*val_real)(struct st_mysql_value *, double *realbuf); |
682 | | int (*val_int)(struct st_mysql_value *, long long *intbuf); |
683 | | int (*is_unsigned)(struct st_mysql_value *); |
684 | | }; |
685 | | |
686 | | |
687 | | /************************************************************************* |
688 | | Miscellaneous functions for plugin implementors |
689 | | */ |
690 | | |
691 | | #ifdef __cplusplus |
692 | | extern "C" { |
693 | | #endif |
694 | | |
695 | | int thd_in_lock_tables(const MYSQL_THD thd); |
696 | | int thd_tablespace_op(const MYSQL_THD thd); |
697 | | long long thd_test_options(const MYSQL_THD thd, long long test_options); |
698 | | int thd_sql_command(const MYSQL_THD thd); |
699 | | struct DDL_options_st; |
700 | | struct DDL_options_st *thd_ddl_options(const MYSQL_THD thd); |
701 | | void thd_storage_lock_wait(MYSQL_THD thd, long long value); |
702 | | int thd_tx_isolation(const MYSQL_THD thd); |
703 | | int thd_tx_is_read_only(const MYSQL_THD thd); |
704 | | |
705 | | /** |
706 | | Create a temporary file. |
707 | | |
708 | | @details |
709 | | The temporary file is created in a location specified by the mysql |
710 | | server configuration (--tmpdir option). The caller does not need to |
711 | | delete the file, it will be deleted automatically. |
712 | | |
713 | | @param prefix prefix for temporary file name |
714 | | @retval -1 error |
715 | | @retval >= 0 a file handle that can be passed to dup or my_close |
716 | | */ |
717 | | int mysql_tmpfile(const char *prefix); |
718 | | |
719 | | /** |
720 | | Return the thread id of a user thread |
721 | | |
722 | | @param thd user thread connection handle |
723 | | @return thread id |
724 | | */ |
725 | | unsigned long thd_get_thread_id(const MYSQL_THD thd); |
726 | | |
727 | | /** |
728 | | Get the XID for this connection's transaction |
729 | | |
730 | | @param thd user thread connection handle |
731 | | @param xid location where identifier is stored |
732 | | */ |
733 | | void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid); |
734 | | |
735 | | /** |
736 | | Invalidate the query cache for a given table. |
737 | | |
738 | | @param thd user thread connection handle |
739 | | @param key databasename\\0tablename\\0 |
740 | | @param key_length length of key in bytes, including the NUL bytes |
741 | | @param using_trx flag: TRUE if using transactions, FALSE otherwise |
742 | | */ |
743 | | void mysql_query_cache_invalidate4(MYSQL_THD thd, |
744 | | const char *key, unsigned int key_length, |
745 | | int using_trx); |
746 | | |
747 | | |
748 | | /** |
749 | | Provide a handler data getter to simplify coding |
750 | | */ |
751 | | void *thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton); |
752 | | |
753 | | |
754 | | /** |
755 | | Provide a handler data setter to simplify coding |
756 | | |
757 | | @details |
758 | | Set ha_data pointer (storage engine per-connection information). |
759 | | |
760 | | To avoid unclean deactivation (uninstall) of storage engine plugin |
761 | | in the middle of transaction, additional storage engine plugin |
762 | | lock is acquired. |
763 | | |
764 | | If ha_data is not null and storage engine plugin was not locked |
765 | | by thd_set_ha_data() in this connection before, storage engine |
766 | | plugin gets locked. |
767 | | |
768 | | If ha_data is null and storage engine plugin was locked by |
769 | | thd_set_ha_data() in this connection before, storage engine |
770 | | plugin lock gets released. |
771 | | |
772 | | If handlerton::close_connection() didn't reset ha_data, server does |
773 | | it immediately after calling handlerton::close_connection(). |
774 | | */ |
775 | | void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton, |
776 | | const void *ha_data); |
777 | | |
778 | | |
779 | | /** |
780 | | Signal that the first part of handler commit is finished, and that the |
781 | | committed transaction is now visible and has fixed commit ordering with |
782 | | respect to other transactions. The commit need _not_ be durable yet, and |
783 | | typically will not be when this call makes sense. |
784 | | |
785 | | This call is optional, if the storage engine does not call it the upper |
786 | | layer will after the handler commit() method is done. However, the storage |
787 | | engine may choose to call it itself to increase the possibility for group |
788 | | commit. |
789 | | |
790 | | In-order parallel replication uses this to apply different transaction in |
791 | | parallel, but delay the commits of later transactions until earlier |
792 | | transactions have committed first, thus achieving increased performance on |
793 | | multi-core systems while still preserving full transaction consistency. |
794 | | |
795 | | The storage engine can call this from within the commit() method, typically |
796 | | after the commit record has been written to the transaction log, but before |
797 | | the log has been fsync()'ed. This will allow the next replicated transaction |
798 | | to proceed to commit before the first one has done fsync() or similar. Thus, |
799 | | it becomes possible for multiple sequential replicated transactions to share |
800 | | a single fsync() inside the engine in group commit. |
801 | | |
802 | | Note that this method should _not_ be called from within the commit_ordered() |
803 | | method, or any other place in the storage engine. When commit_ordered() is |
804 | | used (typically when binlog is enabled), the transaction coordinator takes |
805 | | care of this and makes group commit in the storage engine possible without |
806 | | any other action needed on the part of the storage engine. This function |
807 | | thd_wakeup_subsequent_commits() is only needed when no transaction |
808 | | coordinator is used, meaning a single storage engine and no binary log. |
809 | | */ |
810 | | void thd_wakeup_subsequent_commits(MYSQL_THD thd, int wakeup_error); |
811 | | |
812 | | #ifdef __cplusplus |
813 | | } |
814 | | #endif |
815 | | |
816 | | #endif |
817 | | |