16
16
#include <drizzled/server_includes.h>
17
17
#include <mysys/my_getopt.h>
18
#include <authentication.h>
20
#include <drizzled/drizzled_error_messages.h>
18
#include <mysys/hash.h>
20
#include <drizzled/authentication.h>
21
#include <drizzled/logging.h>
22
#include <drizzled/errmsg.h>
23
#include <drizzled/configvar.h>
24
#include <drizzled/qcache.h>
25
#include <drizzled/parser.h>
26
#include <drizzled/sql_parse.h>
27
#include <drizzled/scheduling.h>
28
#include <drizzled/replicator.h>
29
#include <drizzled/show.h>
30
#include <drizzled/handler.h>
31
#include <drizzled/set_var.h>
32
#include <drizzled/session.h>
33
#include <drizzled/item/null.h>
34
#include <drizzled/plugin_registry.h>
40
#include <drizzled/error.h>
41
#include <drizzled/gettext.h>
21
43
#define REPORT_TO_LOG 1
22
44
#define REPORT_TO_USER 2
24
46
#define plugin_ref_to_int(A) (A ? A[0] : NULL)
25
47
#define plugin_int_to_ref(A) &(A)
27
51
extern struct st_mysql_plugin *mysqld_builtins[];
29
53
char *opt_plugin_load= NULL;
59
89
plugin_type_init plugin_type_initialize[DRIZZLE_MAX_PLUGIN_TYPE_NUM]=
62
ha_initialize_handlerton, /* Storage Engine */
92
storage_engine_initializer, /* Storage Engine */
63
93
initialize_schema_table, /* Information Schema */
64
94
initialize_udf, /* UDF */
67
97
logging_initializer, /* Logger */
68
authentication_initializer /* Auth */
98
errmsg_initializer, /* Error Messages */
99
authentication_initializer, /* Auth */
100
configvar_initializer,
103
scheduling_initializer,
104
replicator_initializer
71
107
plugin_type_init plugin_type_deinitialize[DRIZZLE_MAX_PLUGIN_TYPE_NUM]=
74
ha_finalize_handlerton, /* Storage Engine */
110
storage_engine_finalizer, /* Storage Engine */
75
111
finalize_schema_table, /* Information Schema */
76
112
finalize_udf, /* UDF */
79
115
logging_finalizer, /* Logger */
80
authentication_finalizer /* Auth */
116
errmsg_finalizer, /* Logger */
117
authentication_finalizer, /* Auth */
121
scheduling_finalizer,
83
125
static const char *plugin_declarations_sym= "_mysql_plugin_declarations_";
163
204
sys_var_pluginvar *cast_pluginvar() { return this; }
164
205
bool is_readonly() const { return plugin_var->flags & PLUGIN_VAR_READONLY; }
165
206
bool check_type(enum_var_type type)
166
{ return !(plugin_var->flags & PLUGIN_VAR_THDLOCAL) && type != OPT_GLOBAL; }
207
{ return !(plugin_var->flags & PLUGIN_VAR_SessionLOCAL) && type != OPT_GLOBAL; }
167
208
bool check_update_type(Item_result type);
168
209
SHOW_TYPE show_type();
169
unsigned char* real_value_ptr(THD *thd, enum_var_type type);
210
unsigned char* real_value_ptr(Session *session, enum_var_type type);
170
211
TYPELIB* plugin_var_typelib(void);
171
unsigned char* value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
172
bool check(THD *thd, set_var *var);
173
bool check_default(enum_var_type type __attribute__((unused)))
212
unsigned char* value_ptr(Session *session, enum_var_type type,
213
const LEX_STRING *base);
214
bool check(Session *session, set_var *var);
215
bool check_default(enum_var_type)
174
216
{ return is_readonly(); }
175
void set_default(THD *thd,
176
enum_var_type type __attribute__((unused)));
177
bool update(THD *thd, set_var *var);
217
void set_default(Session *session, enum_var_type);
218
bool update(Session *session, set_var *var);
186
227
static bool register_builtin(struct st_mysql_plugin *, struct st_plugin_int *,
187
228
struct st_plugin_int **);
188
static void unlock_variables(THD *thd, struct system_variables *vars);
189
static void cleanup_variables(THD *thd, struct system_variables *vars);
229
static void unlock_variables(Session *session, struct system_variables *vars);
230
static void cleanup_variables(Session *session, struct system_variables *vars);
190
231
static void plugin_vars_free_values(sys_var *vars);
191
232
static void plugin_opt_set_limits(struct my_option *options,
192
233
const struct st_mysql_sys_var *opt);
193
#define my_intern_plugin_lock(A,B) intern_plugin_lock(A,B CALLER_INFO)
194
#define my_intern_plugin_lock_ci(A,B) intern_plugin_lock(A,B ORIG_CALLER_INFO)
195
static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref plugin
197
static void intern_plugin_unlock(LEX *lex, plugin_ref plugin);
234
static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref plugin);
198
235
static void reap_plugins(void);
201
238
/* declared in set_var.cc */
202
239
extern sys_var *intern_find_sys_var(const char *str, uint32_t length, bool no_error);
203
extern bool throw_bounds_warning(THD *thd, bool fixed, bool unsignd,
240
extern bool throw_bounds_warning(Session *session, bool fixed, bool unsignd,
204
241
const char *name, int64_t val);
206
243
/****************************************************************************
327
365
if (report & REPORT_TO_USER)
328
366
my_error(ER_UDF_NO_PATHS, MYF(0));
329
367
if (report & REPORT_TO_LOG)
330
sql_print_error(ER(ER_UDF_NO_PATHS));
368
errmsg_printf(ERRMSG_LVL_ERROR, "%s",ER(ER_UDF_NO_PATHS));
333
371
/* If this dll is already loaded just increase ref_count. */
334
372
if ((tmp= plugin_dl_find(dl)))
339
376
memset(&plugin_dl, 0, sizeof(plugin_dl));
340
377
/* Compile dll path */
342
strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", dl->str, NULL) -
344
plugin_dl.ref_count= 1;
378
dlpath.append(opt_plugin_dir);
380
dlpath.append(dl->str);
345
381
/* Open new dll handle */
346
if (!(plugin_dl.handle= dlopen(dlpath, RTLD_LAZY|RTLD_GLOBAL)))
382
if (!(plugin_dl.handle= dlopen(dlpath.c_str(), RTLD_LAZY|RTLD_GLOBAL)))
348
384
const char *errmsg=dlerror();
349
if (!strncmp(dlpath, errmsg, dlpathlen))
385
uint32_t dlpathlen= dlpath.length();
386
if (!dlpath.compare(0, dlpathlen, errmsg))
350
387
{ // if errmsg starts from dlpath, trim this prefix.
351
388
errmsg+=dlpathlen;
352
389
if (*errmsg == ':') errmsg++;
353
390
if (*errmsg == ' ') errmsg++;
355
392
if (report & REPORT_TO_USER)
356
my_error(ER_CANT_OPEN_LIBRARY, MYF(0), dlpath, errno, errmsg);
393
my_error(ER_CANT_OPEN_LIBRARY, MYF(0), dlpath.c_str(), errno, errmsg);
357
394
if (report & REPORT_TO_LOG)
358
sql_print_error(ER(ER_CANT_OPEN_LIBRARY), dlpath, errno, errmsg);
395
errmsg_printf(ERRMSG_LVL_ERROR, ER(ER_CANT_OPEN_LIBRARY), dlpath.c_str(), errno, errmsg);
483
static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc CALLER_INFO_PROTO)
502
static plugin_ref intern_plugin_lock(LEX *, plugin_ref rc)
485
504
st_plugin_int *pi= plugin_ref_to_int(rc);
487
if (pi->state & (PLUGIN_IS_READY | PLUGIN_IS_UNINITIALIZED))
491
For debugging, we do an additional malloc which allows the
492
memory manager and/or valgrind to track locked references and
493
double unlocks to aid resolving reference counting.problems.
495
if (!(plugin= (plugin_ref) my_malloc_ci(sizeof(pi), MYF(MY_WME))))
502
insert_dynamic(&lex->plugins, (unsigned char*)&plugin);
511
For debugging, we do an additional malloc which allows the
512
memory manager and/or valgrind to track locked references and
513
double unlocks to aid resolving reference counting.problems.
515
if (!(plugin= (plugin_ref) malloc(sizeof(pi))))
509
plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO)
524
plugin_ref plugin_lock(Session *session, plugin_ref *ptr)
511
LEX *lex= thd ? thd->lex : 0;
526
LEX *lex= session ? session->lex : 0;
513
rc= my_intern_plugin_lock_ci(lex, *ptr);
528
rc= intern_plugin_lock(lex, *ptr);
518
plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name, int type
533
plugin_ref plugin_lock_by_name(Session *session, const LEX_STRING *name, int type)
521
LEX *lex= thd ? thd->lex : 0;
535
Plugin_registry registry= Plugin_registry::get_plugin_registry();
537
LEX *lex= session ? session->lex : 0;
522
538
plugin_ref rc= NULL;
523
539
st_plugin_int *plugin;
524
if ((plugin= plugin_find_internal(name, type)))
525
rc= my_intern_plugin_lock_ci(lex, plugin_int_to_ref(plugin));
543
if ((plugin= registry.find(name, type)))
544
rc= intern_plugin_lock(lex, plugin_int_to_ref(plugin));
530
549
static st_plugin_int *plugin_insert_or_reuse(struct st_plugin_int *plugin)
533
551
struct st_plugin_int *tmp;
534
for (i= 0; i < plugin_array.elements; i++)
536
tmp= *dynamic_element(&plugin_array, i, struct st_plugin_int **);
537
if (tmp->state == PLUGIN_IS_FREED)
539
memcpy(tmp, plugin, sizeof(struct st_plugin_int));
543
552
if (insert_dynamic(&plugin_array, (unsigned char*)&plugin))
545
554
tmp= *dynamic_element(&plugin_array, plugin_array.elements - 1,
612
622
if (report & REPORT_TO_USER)
613
623
my_error(ER_CANT_FIND_DL_ENTRY, MYF(0), name->str);
614
624
if (report & REPORT_TO_LOG)
615
sql_print_error(ER(ER_CANT_FIND_DL_ENTRY), name->str);
625
errmsg_printf(ERRMSG_LVL_ERROR, ER(ER_CANT_FIND_DL_ENTRY), name->str);
617
627
plugin_dl_del(dl);
622
static void plugin_deinitialize(struct st_plugin_int *plugin, bool ref_check)
624
if (plugin->plugin->status_vars)
628
We have a problem right now where we can not prepend without
629
breaking backwards compatibility. We will fix this shortly so
630
that engines have "use names" and we wil use those for
631
CREATE TABLE, and use the plugin name then for adding automatic
635
{plugin->plugin->name, (char*)plugin->plugin->status_vars, SHOW_ARRAY},
638
remove_status_vars(array);
640
remove_status_vars(plugin->plugin->status_vars);
641
#endif /* FIX_LATER */
644
if (plugin_type_deinitialize[plugin->plugin->type])
646
if ((*plugin_type_deinitialize[plugin->plugin->type])(plugin))
648
sql_print_error(_("Plugin '%s' of type %s failed deinitialization"),
649
plugin->name.str, plugin_type_names[plugin->plugin->type].str);
652
else if (plugin->plugin->deinit)
653
plugin->plugin->deinit(plugin);
655
plugin->state= PLUGIN_IS_UNINITIALIZED;
658
We do the check here because NDB has a worker THD which doesn't
659
exit until NDB is shut down.
661
if (ref_check && plugin->ref_count)
662
sql_print_error(_("Plugin '%s' has ref_count=%d after deinitialization."),
663
plugin->name.str, plugin->ref_count);
667
632
static void plugin_del(struct st_plugin_int *plugin)
634
if (plugin->isInited)
636
if (plugin->plugin->status_vars)
638
remove_status_vars(plugin->plugin->status_vars);
641
if (plugin_type_deinitialize[plugin->plugin->type])
643
if ((*plugin_type_deinitialize[plugin->plugin->type])(plugin))
645
errmsg_printf(ERRMSG_LVL_ERROR, _("Plugin '%s' of type %s failed deinitialization"),
646
plugin->name.str, plugin_type_names[plugin->plugin->type].str);
649
else if (plugin->plugin->deinit)
650
plugin->plugin->deinit(plugin);
669
653
/* Free allocated strings before deleting the plugin. */
670
654
plugin_vars_free_values(plugin->system_vars);
671
hash_delete(&plugin_hash[plugin->plugin->type], (unsigned char*)plugin);
672
655
if (plugin->plugin_dl)
673
656
plugin_dl_del(&plugin->plugin_dl->dl);
674
plugin->state= PLUGIN_IS_FREED;
657
plugin->isInited= false;
675
658
plugin_array_version++;
676
rw_wrlock(&LOCK_system_variables_hash);
659
pthread_rwlock_wrlock(&LOCK_system_variables_hash);
677
660
mysql_del_sys_var_chain(plugin->system_vars);
678
rw_unlock(&LOCK_system_variables_hash);
661
pthread_rwlock_unlock(&LOCK_system_variables_hash);
679
662
free_root(&plugin->mem_root, MYF(0));
683
665
static void reap_plugins(void)
686
struct st_plugin_int *plugin, **reap, **list;
669
struct st_plugin_int *plugin;
692
671
count= plugin_array.elements;
693
reap= (struct st_plugin_int **)my_alloca(sizeof(plugin)*(count+1));
696
673
for (idx= 0; idx < count; idx++)
698
675
plugin= *dynamic_element(&plugin_array, idx, struct st_plugin_int **);
699
if (plugin->state == PLUGIN_IS_DELETED && !plugin->ref_count)
701
/* change the status flag to prevent reaping by another thread */
702
plugin->state= PLUGIN_IS_DYING;
708
while ((plugin= *(--list)))
709
plugin_deinitialize(plugin, true);
711
while ((plugin= *(--reap)))
712
676
plugin_del(plugin);
717
static void intern_plugin_unlock(LEX *lex, plugin_ref plugin)
725
pi= plugin_ref_to_int(plugin);
727
free((unsigned char*) plugin);
732
Remove one instance of this plugin from the use list.
733
We are searching backwards so that plugins locked last
734
could be unlocked faster - optimizing for LIFO semantics.
736
for (i= lex->plugins.elements - 1; i >= 0; i--)
737
if (plugin == *dynamic_element(&lex->plugins, i, plugin_ref*))
739
delete_dynamic_element(&lex->plugins, i);
745
assert(pi->ref_count);
748
if (pi->state == PLUGIN_IS_DELETED && !pi->ref_count)
755
void plugin_unlock(THD *thd, plugin_ref plugin)
757
LEX *lex= thd ? thd->lex : 0;
760
intern_plugin_unlock(lex, plugin);
765
void plugin_unlock_list(THD *thd, plugin_ref *list, uint32_t count)
767
LEX *lex= thd ? thd->lex : 0;
770
intern_plugin_unlock(lex, *list++);
775
static int plugin_initialize(struct st_plugin_int *plugin)
680
static bool plugin_initialize(struct st_plugin_int *plugin)
682
assert(plugin->isInited == false);
778
684
if (plugin_type_initialize[plugin->plugin->type])
780
686
if ((*plugin_type_initialize[plugin->plugin->type])(plugin))
782
sql_print_error(_("Plugin '%s' registration as a %s failed."),
688
errmsg_printf(ERRMSG_LVL_ERROR, _("Plugin '%s' registration as a %s failed."),
783
689
plugin->name.str, plugin_type_names[plugin->plugin->type].str);
1102
955
void plugin_shutdown(void)
1104
uint32_t i, count= plugin_array.elements, free_slots= 0;
1105
struct st_plugin_int **plugins, *plugin;
1106
struct st_plugin_dl **dl;
958
size_t count= plugin_array.elements;
959
vector<st_plugin_int *> plugins;
960
vector<st_plugin_dl *> dl;
1108
962
if (initialized)
1110
964
reap_needed= true;
1113
We want to shut down plugins in a reasonable order, this will
1114
become important when we have plugins which depend upon each other.
1115
Circular references cannot be reaped so they are forced afterwards.
1116
TODO: Have an additional step here to notify all active plugins that
1117
shutdown is requested to allow plugins to deinitialize in parallel.
1119
while (reap_needed && (count= plugin_array.elements))
1122
for (i= free_slots= 0; i < count; i++)
1124
plugin= *dynamic_element(&plugin_array, i, struct st_plugin_int **);
1125
switch (plugin->state) {
1126
case PLUGIN_IS_READY:
1127
plugin->state= PLUGIN_IS_DELETED;
1130
case PLUGIN_IS_FREED:
1131
case PLUGIN_IS_UNINITIALIZED:
1139
release any plugin references held.
1141
unlock_variables(NULL, &global_system_variables);
1142
unlock_variables(NULL, &max_system_variables);
1146
if (count > free_slots)
1147
sql_print_warning(_("Forcing shutdown of %d plugins"),
1148
count - free_slots);
1150
plugins= (struct st_plugin_int **) my_alloca(sizeof(void*) * (count+1));
1153
If we have any plugins which did not die cleanly, we force shutdown
1155
for (i= 0; i < count; i++)
1157
plugins[i]= *dynamic_element(&plugin_array, i, struct st_plugin_int **);
1158
/* change the state to ensure no reaping races */
1159
if (plugins[i]->state == PLUGIN_IS_DELETED)
1160
plugins[i]->state= PLUGIN_IS_DYING;
1164
We loop through all plugins and call deinit() if they have one.
1166
for (i= 0; i < count; i++)
1167
if (!(plugins[i]->state & (PLUGIN_IS_UNINITIALIZED | PLUGIN_IS_FREED)))
1169
sql_print_information(_("Plugin '%s' will be forced to shutdown"),
1170
plugins[i]->name.str);
1172
We are forcing deinit on plugins so we don't want to do a ref_count
1173
check until we have processed all the plugins.
1175
plugin_deinitialize(plugins[i], false);
1179
We defer checking ref_counts until after all plugins are deinitialized
1180
as some may have worker threads holding on to plugin references.
1182
for (i= 0; i < count; i++)
1184
if (plugins[i]->ref_count)
1185
sql_print_error(_("Plugin '%s' has ref_count=%d after shutdown."),
1186
plugins[i]->name.str, plugins[i]->ref_count);
1187
if (plugins[i]->state & PLUGIN_IS_UNINITIALIZED)
1188
plugin_del(plugins[i]);
1192
Now we can deallocate all memory.
967
unlock_variables(NULL, &global_system_variables);
968
unlock_variables(NULL, &max_system_variables);
1195
970
cleanup_variables(NULL, &global_system_variables);
1196
971
cleanup_variables(NULL, &max_system_variables);
1203
976
/* Dispose of the memory */
1205
for (i= 0; i < DRIZZLE_MAX_PLUGIN_TYPE_NUM; i++)
1206
hash_free(&plugin_hash[i]);
1207
978
delete_dynamic(&plugin_array);
1209
980
count= plugin_dl_array.elements;
1210
dl= (struct st_plugin_dl **)my_alloca(sizeof(void*) * count);
1211
for (i= 0; i < count; i++)
1212
dl[i]= *dynamic_element(&plugin_dl_array, i, struct st_plugin_dl **);
1213
for (i= 0; i < plugin_dl_array.elements; i++)
1214
free_plugin_mem(dl[i]);
982
for (idx= 0; idx < count; idx++)
983
dl.push_back(*dynamic_element(&plugin_dl_array, idx,
984
struct st_plugin_dl **));
985
for (idx= 0; idx < count; idx++)
986
free_plugin_mem(dl[idx]);
1216
987
delete_dynamic(&plugin_dl_array);
1218
989
hash_free(&bookmark_hash);
1219
990
free_root(&plugin_mem_root, MYF(0));
1221
992
global_variables_dynamic_size= 0;
1227
bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func,
1228
int type, uint32_t state_mask, void *arg)
997
* all: List all plugins
999
bool plugin_foreach(Session *session, plugin_foreach_func *func, int type, void *arg, bool all)
1230
uint32_t idx, total;
1231
struct st_plugin_int *plugin, **plugins;
1002
struct st_plugin_int *plugin;
1003
vector<st_plugin_int *> plugins;
1232
1004
int version=plugin_array_version;
1234
1006
if (!initialized)
1237
state_mask= ~state_mask; // do it only once
1239
total= type == DRIZZLE_ANY_PLUGIN ? plugin_array.elements
1240
: plugin_hash[type].records;
1242
Do the alloca out here in case we do have a working alloca:
1243
leaving the nested stack frame invalidates alloca allocation.
1245
plugins=(struct st_plugin_int **)my_alloca(total*sizeof(plugin));
1246
1009
if (type == DRIZZLE_ANY_PLUGIN)
1248
for (idx= 0; idx < total; idx++)
1011
plugins.reserve(plugin_array.elements);
1012
for (idx= 0; idx < plugin_array.elements; idx++)
1250
1014
plugin= *dynamic_element(&plugin_array, idx, struct st_plugin_int **);
1251
plugins[idx]= !(plugin->state & state_mask) ? plugin : NULL;
1016
plugins.push_back(plugin);
1017
else if (plugin->isInited)
1018
plugins.push_back(plugin);
1256
HASH *hash= plugin_hash + type;
1257
for (idx= 0; idx < total; idx++)
1259
plugin= (struct st_plugin_int *) hash_element(hash, idx);
1260
plugins[idx]= !(plugin->state & state_mask) ? plugin : NULL;
1023
Plugin_registry registry= Plugin_registry::get_plugin_registry();
1024
registry.get_list(type, plugins, all);
1263
for (idx= 0; idx < total; idx++)
1027
vector<st_plugin_int *>::iterator plugin_iter;
1028
for (plugin_iter= plugins.begin();
1029
plugin_iter != plugins.end();
1265
1032
if (unlikely(version != plugin_array_version))
1267
for (uint32_t i=idx; i < total; i++)
1268
if (plugins[i] && plugins[i]->state & state_mask)
1034
vector<st_plugin_int *>::iterator reset_iter;
1035
for (reset_iter= plugin_iter;
1036
reset_iter != plugins.end();
1038
if (*reset_iter && (*reset_iter)->isInited && all)
1271
plugin= plugins[idx];
1041
plugin= *plugin_iter;
1272
1042
/* It will stop iterating on first engine error when "func" returns true */
1273
if (plugin && func(thd, plugin_int_to_ref(plugin), arg))
1043
if (plugin && func(session, plugin_int_to_ref(plugin), arg))
1293
1061
#define EXTRA_OPTIONS 3 /* options for: 'foo', 'plugin-foo' and NULL */
1295
1063
typedef DECLARE_DRIZZLE_SYSVAR_BASIC(sysvar_bool_t, bool);
1296
typedef DECLARE_DRIZZLE_THDVAR_BASIC(thdvar_bool_t, bool);
1064
typedef DECLARE_DRIZZLE_SessionVAR_BASIC(sessionvar_bool_t, bool);
1297
1065
typedef DECLARE_DRIZZLE_SYSVAR_BASIC(sysvar_str_t, char *);
1298
typedef DECLARE_DRIZZLE_THDVAR_BASIC(thdvar_str_t, char *);
1066
typedef DECLARE_DRIZZLE_SessionVAR_BASIC(sessionvar_str_t, char *);
1300
1068
typedef DECLARE_DRIZZLE_SYSVAR_TYPELIB(sysvar_enum_t, unsigned long);
1301
typedef DECLARE_DRIZZLE_THDVAR_TYPELIB(thdvar_enum_t, unsigned long);
1069
typedef DECLARE_DRIZZLE_SessionVAR_TYPELIB(sessionvar_enum_t, unsigned long);
1302
1070
typedef DECLARE_DRIZZLE_SYSVAR_TYPELIB(sysvar_set_t, uint64_t);
1303
typedef DECLARE_DRIZZLE_THDVAR_TYPELIB(thdvar_set_t, uint64_t);
1071
typedef DECLARE_DRIZZLE_SessionVAR_TYPELIB(sessionvar_set_t, uint64_t);
1305
1073
typedef DECLARE_DRIZZLE_SYSVAR_SIMPLE(sysvar_int_t, int);
1306
1074
typedef DECLARE_DRIZZLE_SYSVAR_SIMPLE(sysvar_long_t, long);
1309
1077
typedef DECLARE_DRIZZLE_SYSVAR_SIMPLE(sysvar_ulong_t, ulong);
1310
1078
typedef DECLARE_DRIZZLE_SYSVAR_SIMPLE(sysvar_uint64_t_t, uint64_t);
1312
typedef DECLARE_DRIZZLE_THDVAR_SIMPLE(thdvar_int_t, int);
1313
typedef DECLARE_DRIZZLE_THDVAR_SIMPLE(thdvar_long_t, long);
1314
typedef DECLARE_DRIZZLE_THDVAR_SIMPLE(thdvar_int64_t_t, int64_t);
1315
typedef DECLARE_DRIZZLE_THDVAR_SIMPLE(thdvar_uint_t, uint);
1316
typedef DECLARE_DRIZZLE_THDVAR_SIMPLE(thdvar_ulong_t, ulong);
1317
typedef DECLARE_DRIZZLE_THDVAR_SIMPLE(thdvar_uint64_t_t, uint64_t);
1080
typedef DECLARE_DRIZZLE_SessionVAR_SIMPLE(sessionvar_int_t, int);
1081
typedef DECLARE_DRIZZLE_SessionVAR_SIMPLE(sessionvar_long_t, long);
1082
typedef DECLARE_DRIZZLE_SessionVAR_SIMPLE(sessionvar_int64_t_t, int64_t);
1083
typedef DECLARE_DRIZZLE_SessionVAR_SIMPLE(sessionvar_uint_t, uint);
1084
typedef DECLARE_DRIZZLE_SessionVAR_SIMPLE(sessionvar_ulong_t, ulong);
1085
typedef DECLARE_DRIZZLE_SessionVAR_SIMPLE(sessionvar_uint64_t_t, uint64_t);
1319
typedef bool *(*mysql_sys_var_ptr_p)(THD* a_thd, int offset);
1087
typedef bool *(*mysql_sys_var_ptr_p)(Session* a_session, int offset);
1322
1090
/****************************************************************************
1323
1091
default variable data check and update functions
1324
1092
****************************************************************************/
1326
static int check_func_bool(THD *thd __attribute__((unused)),
1327
struct st_mysql_sys_var *var,
1094
static int check_func_bool(Session *, struct st_mysql_sys_var *var,
1328
1095
void *save, st_mysql_value *value)
1330
1097
char buff[STRING_BUFFER_USUAL_SIZE];
1539
static void update_func_bool(THD *thd __attribute__((unused)),
1540
struct st_mysql_sys_var *var __attribute__((unused)),
1305
static void update_func_bool(Session *, struct st_mysql_sys_var *,
1541
1306
void *tgt, const void *save)
1543
1308
*(bool *) tgt= *(int *) save ? 1 : 0;
1547
static void update_func_int(THD *thd __attribute__((unused)),
1548
struct st_mysql_sys_var *var __attribute__((unused)),
1312
static void update_func_int(Session *, struct st_mysql_sys_var *,
1549
1313
void *tgt, const void *save)
1551
1315
*(int *)tgt= *(int *) save;
1555
static void update_func_long(THD *thd __attribute__((unused)),
1556
struct st_mysql_sys_var *var __attribute__((unused)),
1319
static void update_func_long(Session *, struct st_mysql_sys_var *,
1557
1320
void *tgt, const void *save)
1559
1322
*(long *)tgt= *(long *) save;
1563
static void update_func_int64_t(THD *thd __attribute__((unused)),
1564
struct st_mysql_sys_var *var __attribute__((unused)),
1326
static void update_func_int64_t(Session *, struct st_mysql_sys_var *,
1565
1327
void *tgt, const void *save)
1567
1329
*(int64_t *)tgt= *(uint64_t *) save;
1571
static void update_func_str(THD *thd __attribute__((unused)), struct st_mysql_sys_var *var,
1333
static void update_func_str(Session *, struct st_mysql_sys_var *var,
1572
1334
void *tgt, const void *save)
1574
1336
char *old= *(char **) tgt;
1575
1337
*(char **)tgt= *(char **) save;
1576
1338
if (var->flags & PLUGIN_VAR_MEMALLOC)
1578
*(char **)tgt= my_strdup(*(char **) save, MYF(0));
1340
*(char **)tgt= strdup(*(char **) save);
1343
* There isn't a _really_ good thing to do here until this whole set_var
1344
* mess gets redesigned
1347
errmsg_printf(ERRMSG_LVL_ERROR, _("Out of memory."));
1586
1355
****************************************************************************/
1589
sys_var *find_sys_var(THD *thd, const char *str, uint32_t length)
1358
sys_var *find_sys_var(Session *session, const char *str, uint32_t length)
1592
1361
sys_var_pluginvar *pi= NULL;
1593
1362
plugin_ref plugin;
1595
rw_rdlock(&LOCK_system_variables_hash);
1364
pthread_rwlock_rdlock(&LOCK_system_variables_hash);
1596
1365
if ((var= intern_find_sys_var(str, length, false)) &&
1597
1366
(pi= var->cast_pluginvar()))
1599
rw_unlock(&LOCK_system_variables_hash);
1600
LEX *lex= thd ? thd->lex : 0;
1601
if (!(plugin= my_intern_plugin_lock(lex, plugin_int_to_ref(pi->plugin))))
1368
pthread_rwlock_unlock(&LOCK_system_variables_hash);
1369
LEX *lex= session ? session->lex : 0;
1370
if (!(plugin= intern_plugin_lock(lex, plugin_int_to_ref(pi->plugin))))
1602
1371
var= NULL; /* failed to lock it, it must be uninstalling */
1604
if (!(plugin_state(plugin) & PLUGIN_IS_READY))
1372
else if (plugin[0]->isInited == false)
1606
/* initialization not completed */
1608
intern_plugin_unlock(lex, plugin);
1612
rw_unlock(&LOCK_system_variables_hash);
1378
pthread_rwlock_unlock(&LOCK_system_variables_hash);
1615
1381
If the variable exists but the plugin it is associated with is not ready
1769
returns a pointer to the memory which holds the thd-local variable or
1770
a pointer to the global variable if thd==null.
1542
returns a pointer to the memory which holds the session-local variable or
1543
a pointer to the global variable if session==null.
1771
1544
If required, will sync with global variables if the requested variable
1772
1545
has not yet been allocated in the current thread.
1774
static unsigned char *intern_sys_var_ptr(THD* thd, int offset, bool global_lock)
1547
static unsigned char *intern_sys_var_ptr(Session* session, int offset, bool global_lock)
1776
1549
assert(offset >= 0);
1777
assert((uint)offset <= global_system_variables.dynamic_variables_head);
1550
assert((uint32_t)offset <= global_system_variables.dynamic_variables_head);
1780
1553
return (unsigned char*) global_system_variables.dynamic_variables_ptr + offset;
1783
1556
dynamic_variables_head points to the largest valid offset
1785
if (!thd->variables.dynamic_variables_ptr ||
1786
(uint)offset > thd->variables.dynamic_variables_head)
1558
if (!session->variables.dynamic_variables_ptr ||
1559
(uint32_t)offset > session->variables.dynamic_variables_head)
1790
rw_rdlock(&LOCK_system_variables_hash);
1563
pthread_rwlock_rdlock(&LOCK_system_variables_hash);
1792
thd->variables.dynamic_variables_ptr= (char*)
1793
my_realloc(thd->variables.dynamic_variables_ptr,
1794
global_variables_dynamic_size,
1795
MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
1566
if (!(tmpptr= (char *)realloc(session->variables.dynamic_variables_ptr,
1567
global_variables_dynamic_size)))
1569
session->variables.dynamic_variables_ptr= tmpptr;
1797
1571
if (global_lock)
1798
1572
pthread_mutex_lock(&LOCK_global_system_variables);
1800
1574
safe_mutex_assert_owner(&LOCK_global_system_variables);
1802
memcpy(thd->variables.dynamic_variables_ptr +
1803
thd->variables.dynamic_variables_size,
1576
memcpy(session->variables.dynamic_variables_ptr +
1577
session->variables.dynamic_variables_size,
1804
1578
global_system_variables.dynamic_variables_ptr +
1805
thd->variables.dynamic_variables_size,
1579
session->variables.dynamic_variables_size,
1806
1580
global_system_variables.dynamic_variables_size -
1807
thd->variables.dynamic_variables_size);
1581
session->variables.dynamic_variables_size);
1810
1584
now we need to iterate through any newly copied 'defaults'
1827
1601
if ((pi->plugin_var->flags & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_STR &&
1828
1602
pi->plugin_var->flags & PLUGIN_VAR_MEMALLOC)
1830
char **pp= (char**) (thd->variables.dynamic_variables_ptr +
1604
char **pp= (char**) (session->variables.dynamic_variables_ptr +
1831
1605
*(int*)(pi->plugin_var + 1));
1832
1606
if ((*pp= *(char**) (global_system_variables.dynamic_variables_ptr +
1833
1607
*(int*)(pi->plugin_var + 1))))
1834
*pp= my_strdup(*pp, MYF(MY_WME|MY_FAE));
1838
1614
if (global_lock)
1839
1615
pthread_mutex_unlock(&LOCK_global_system_variables);
1841
thd->variables.dynamic_variables_version=
1617
session->variables.dynamic_variables_version=
1842
1618
global_system_variables.dynamic_variables_version;
1843
thd->variables.dynamic_variables_head=
1619
session->variables.dynamic_variables_head=
1844
1620
global_system_variables.dynamic_variables_head;
1845
thd->variables.dynamic_variables_size=
1621
session->variables.dynamic_variables_size=
1846
1622
global_system_variables.dynamic_variables_size;
1848
rw_unlock(&LOCK_system_variables_hash);
1624
pthread_rwlock_unlock(&LOCK_system_variables_hash);
1850
return (unsigned char*)thd->variables.dynamic_variables_ptr + offset;
1853
static bool *mysql_sys_var_ptr_bool(THD* a_thd, int offset)
1855
return (bool *)intern_sys_var_ptr(a_thd, offset, true);
1858
static int *mysql_sys_var_ptr_int(THD* a_thd, int offset)
1860
return (int *)intern_sys_var_ptr(a_thd, offset, true);
1863
static long *mysql_sys_var_ptr_long(THD* a_thd, int offset)
1865
return (long *)intern_sys_var_ptr(a_thd, offset, true);
1868
static int64_t *mysql_sys_var_ptr_int64_t(THD* a_thd, int offset)
1870
return (int64_t *)intern_sys_var_ptr(a_thd, offset, true);
1873
static char **mysql_sys_var_ptr_str(THD* a_thd, int offset)
1875
return (char **)intern_sys_var_ptr(a_thd, offset, true);
1878
static uint64_t *mysql_sys_var_ptr_set(THD* a_thd, int offset)
1880
return (uint64_t *)intern_sys_var_ptr(a_thd, offset, true);
1883
static unsigned long *mysql_sys_var_ptr_enum(THD* a_thd, int offset)
1885
return (unsigned long *)intern_sys_var_ptr(a_thd, offset, true);
1889
void plugin_thdvar_init(THD *thd)
1891
plugin_ref old_table_plugin= thd->variables.table_plugin;
1893
thd->variables.table_plugin= NULL;
1894
cleanup_variables(thd, &thd->variables);
1896
thd->variables= global_system_variables;
1897
thd->variables.table_plugin= NULL;
1626
return (unsigned char*)session->variables.dynamic_variables_ptr + offset;
1629
static bool *mysql_sys_var_ptr_bool(Session* a_session, int offset)
1631
return (bool *)intern_sys_var_ptr(a_session, offset, true);
1634
static int *mysql_sys_var_ptr_int(Session* a_session, int offset)
1636
return (int *)intern_sys_var_ptr(a_session, offset, true);
1639
static long *mysql_sys_var_ptr_long(Session* a_session, int offset)
1641
return (long *)intern_sys_var_ptr(a_session, offset, true);
1644
static int64_t *mysql_sys_var_ptr_int64_t(Session* a_session, int offset)
1646
return (int64_t *)intern_sys_var_ptr(a_session, offset, true);
1649
static char **mysql_sys_var_ptr_str(Session* a_session, int offset)
1651
return (char **)intern_sys_var_ptr(a_session, offset, true);
1654
static uint64_t *mysql_sys_var_ptr_set(Session* a_session, int offset)
1656
return (uint64_t *)intern_sys_var_ptr(a_session, offset, true);
1659
static unsigned long *mysql_sys_var_ptr_enum(Session* a_session, int offset)
1661
return (unsigned long *)intern_sys_var_ptr(a_session, offset, true);
1665
void plugin_sessionvar_init(Session *session)
1667
session->variables.table_plugin= NULL;
1668
cleanup_variables(session, &session->variables);
1670
session->variables= global_system_variables;
1671
session->variables.table_plugin= NULL;
1899
1673
/* we are going to allocate these lazily */
1900
thd->variables.dynamic_variables_version= 0;
1901
thd->variables.dynamic_variables_size= 0;
1902
thd->variables.dynamic_variables_ptr= 0;
1674
session->variables.dynamic_variables_version= 0;
1675
session->variables.dynamic_variables_size= 0;
1676
session->variables.dynamic_variables_ptr= 0;
1904
thd->variables.table_plugin=
1905
my_intern_plugin_lock(NULL, global_system_variables.table_plugin);
1906
intern_plugin_unlock(NULL, old_table_plugin);
1678
session->variables.table_plugin=
1679
intern_plugin_lock(NULL, global_system_variables.table_plugin);
1912
1684
Unlocks all system variables which hold a reference
1914
static void unlock_variables(THD *thd __attribute__((unused)),
1915
struct system_variables *vars)
1686
static void unlock_variables(Session *, struct system_variables *vars)
1917
intern_plugin_unlock(NULL, vars->table_plugin);
1918
1688
vars->table_plugin= NULL;
2151
1906
pthread_mutex_lock(&LOCK_global_system_variables);
2152
tgt= real_value_ptr(thd, type);
1907
tgt= real_value_ptr(session, type);
2153
1908
src= ((void **) (plugin_var + 1) + 1);
2155
if (plugin_var->flags & PLUGIN_VAR_THDLOCAL)
1910
if (plugin_var->flags & PLUGIN_VAR_SessionLOCAL)
2157
1912
if (type != OPT_GLOBAL)
2158
src= real_value_ptr(thd, OPT_GLOBAL);
1913
src= real_value_ptr(session, OPT_GLOBAL);
2160
1915
switch (plugin_var->flags & PLUGIN_VAR_TYPEMASK) {
2161
1916
case PLUGIN_VAR_INT:
2162
src= &((thdvar_uint_t*) plugin_var)->def_val;
1917
src= &((sessionvar_uint_t*) plugin_var)->def_val;
2164
1919
case PLUGIN_VAR_LONG:
2165
src= &((thdvar_ulong_t*) plugin_var)->def_val;
1920
src= &((sessionvar_ulong_t*) plugin_var)->def_val;
2167
1922
case PLUGIN_VAR_LONGLONG:
2168
src= &((thdvar_uint64_t_t*) plugin_var)->def_val;
1923
src= &((sessionvar_uint64_t_t*) plugin_var)->def_val;
2170
1925
case PLUGIN_VAR_ENUM:
2171
src= &((thdvar_enum_t*) plugin_var)->def_val;
1926
src= &((sessionvar_enum_t*) plugin_var)->def_val;
2173
1928
case PLUGIN_VAR_SET:
2174
src= &((thdvar_set_t*) plugin_var)->def_val;
1929
src= &((sessionvar_set_t*) plugin_var)->def_val;
2176
1931
case PLUGIN_VAR_BOOL:
2177
src= &((thdvar_bool_t*) plugin_var)->def_val;
1932
src= &((sessionvar_bool_t*) plugin_var)->def_val;
2179
1934
case PLUGIN_VAR_STR:
2180
src= &((thdvar_str_t*) plugin_var)->def_val;
1935
src= &((sessionvar_str_t*) plugin_var)->def_val;
2187
/* thd must equal current_thd if PLUGIN_VAR_THDLOCAL flag is set */
2188
assert(!(plugin_var->flags & PLUGIN_VAR_THDLOCAL) ||
2189
thd == current_thd);
1942
/* session must equal current_session if PLUGIN_VAR_SessionLOCAL flag is set */
1943
assert(!(plugin_var->flags & PLUGIN_VAR_SessionLOCAL) ||
1944
session == current_session);
2191
if (!(plugin_var->flags & PLUGIN_VAR_THDLOCAL) || type == OPT_GLOBAL)
1946
if (!(plugin_var->flags & PLUGIN_VAR_SessionLOCAL) || type == OPT_GLOBAL)
2193
plugin_var->update(thd, plugin_var, tgt, src);
1948
plugin_var->update(session, plugin_var, tgt, src);
2194
1949
pthread_mutex_unlock(&LOCK_global_system_variables);
2198
1953
pthread_mutex_unlock(&LOCK_global_system_variables);
2199
plugin_var->update(thd, plugin_var, tgt, src);
1954
plugin_var->update(session, plugin_var, tgt, src);
2204
bool sys_var_pluginvar::update(THD *thd, set_var *var)
1959
bool sys_var_pluginvar::update(Session *session, set_var *var)
2208
1963
assert(is_readonly() || plugin_var->update);
2210
/* thd must equal current_thd if PLUGIN_VAR_THDLOCAL flag is set */
2211
assert(!(plugin_var->flags & PLUGIN_VAR_THDLOCAL) ||
2212
thd == current_thd);
1965
/* session must equal current_session if PLUGIN_VAR_SessionLOCAL flag is set */
1966
assert(!(plugin_var->flags & PLUGIN_VAR_SessionLOCAL) ||
1967
session == current_session);
2214
1969
if (is_readonly())
2217
1972
pthread_mutex_lock(&LOCK_global_system_variables);
2218
tgt= real_value_ptr(thd, var->type);
1973
tgt= real_value_ptr(session, var->type);
2220
if (!(plugin_var->flags & PLUGIN_VAR_THDLOCAL) || var->type == OPT_GLOBAL)
1975
if (!(plugin_var->flags & PLUGIN_VAR_SessionLOCAL) || var->type == OPT_GLOBAL)
2222
1977
/* variable we are updating has global scope, so we unlock after updating */
2223
plugin_var->update(thd, plugin_var, tgt, &var->save_result);
1978
plugin_var->update(session, plugin_var, tgt, &var->save_result);
2224
1979
pthread_mutex_unlock(&LOCK_global_system_variables);
2228
1983
pthread_mutex_unlock(&LOCK_global_system_variables);
2229
plugin_var->update(thd, plugin_var, tgt, &var->save_result);
1984
plugin_var->update(session, plugin_var, tgt, &var->save_result);
2290
2045
options->def_value= (intptr_t) ((sysvar_str_t*) opt)->def_val;
2292
2047
/* threadlocal variables */
2293
case PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL:
2294
OPTION_SET_LIMITS(GET_INT, options, (thdvar_int_t*) opt);
2296
case PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL:
2297
OPTION_SET_LIMITS(GET_UINT, options, (thdvar_uint_t*) opt);
2299
case PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL:
2300
OPTION_SET_LIMITS(GET_LONG, options, (thdvar_long_t*) opt);
2302
case PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL:
2303
OPTION_SET_LIMITS(GET_ULONG, options, (thdvar_ulong_t*) opt);
2305
case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL:
2306
OPTION_SET_LIMITS(GET_LL, options, (thdvar_int64_t_t*) opt);
2308
case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL:
2309
OPTION_SET_LIMITS(GET_ULL, options, (thdvar_uint64_t_t*) opt);
2311
case PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL:
2048
case PLUGIN_VAR_INT | PLUGIN_VAR_SessionLOCAL:
2049
OPTION_SET_LIMITS(GET_INT, options, (sessionvar_int_t*) opt);
2051
case PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_SessionLOCAL:
2052
OPTION_SET_LIMITS(GET_UINT, options, (sessionvar_uint_t*) opt);
2054
case PLUGIN_VAR_LONG | PLUGIN_VAR_SessionLOCAL:
2055
OPTION_SET_LIMITS(GET_LONG, options, (sessionvar_long_t*) opt);
2057
case PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_SessionLOCAL:
2058
OPTION_SET_LIMITS(GET_ULONG_IS_FAIL, options, (sessionvar_ulong_t*) opt);
2060
case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_SessionLOCAL:
2061
OPTION_SET_LIMITS(GET_LL, options, (sessionvar_int64_t_t*) opt);
2063
case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_SessionLOCAL:
2064
OPTION_SET_LIMITS(GET_ULL, options, (sessionvar_uint64_t_t*) opt);
2066
case PLUGIN_VAR_ENUM | PLUGIN_VAR_SessionLOCAL:
2312
2067
options->var_type= GET_ENUM;
2313
options->typelib= ((thdvar_enum_t*) opt)->typelib;
2314
options->def_value= ((thdvar_enum_t*) opt)->def_val;
2068
options->typelib= ((sessionvar_enum_t*) opt)->typelib;
2069
options->def_value= ((sessionvar_enum_t*) opt)->def_val;
2315
2070
options->min_value= options->block_size= 0;
2316
2071
options->max_value= options->typelib->count - 1;
2318
case PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL:
2073
case PLUGIN_VAR_SET | PLUGIN_VAR_SessionLOCAL:
2319
2074
options->var_type= GET_SET;
2320
options->typelib= ((thdvar_set_t*) opt)->typelib;
2321
options->def_value= ((thdvar_set_t*) opt)->def_val;
2075
options->typelib= ((sessionvar_set_t*) opt)->typelib;
2076
options->def_value= ((sessionvar_set_t*) opt)->def_val;
2322
2077
options->min_value= options->block_size= 0;
2323
2078
options->max_value= (1UL << options->typelib->count) - 1;
2325
case PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL:
2080
case PLUGIN_VAR_BOOL | PLUGIN_VAR_SessionLOCAL:
2326
2081
options->var_type= GET_BOOL;
2327
options->def_value= ((thdvar_bool_t*) opt)->def_val;
2082
options->def_value= ((sessionvar_bool_t*) opt)->def_val;
2329
case PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL:
2084
case PLUGIN_VAR_STR | PLUGIN_VAR_SessionLOCAL:
2330
2085
options->var_type= ((opt->flags & PLUGIN_VAR_MEMALLOC) ?
2331
2086
GET_STR_ALLOC : GET_STR);
2332
options->def_value= (intptr_t) ((thdvar_str_t*) opt)->def_val;
2087
options->def_value= (intptr_t) ((sessionvar_str_t*) opt)->def_val;
2404
2158
plugin_option && *plugin_option; plugin_option++, index++)
2406
2160
opt= *plugin_option;
2407
if (!(opt->flags & PLUGIN_VAR_THDLOCAL))
2161
if (!(opt->flags & PLUGIN_VAR_SessionLOCAL))
2409
2163
if (!(register_var(name, opt->name, opt->flags)))
2411
2165
switch (opt->flags & PLUGIN_VAR_TYPEMASK) {
2412
2166
case PLUGIN_VAR_BOOL:
2413
(((thdvar_bool_t *)opt)->resolve)= mysql_sys_var_ptr_bool;
2167
(((sessionvar_bool_t *)opt)->resolve)= mysql_sys_var_ptr_bool;
2415
2169
case PLUGIN_VAR_INT:
2416
(((thdvar_int_t *)opt)->resolve)= mysql_sys_var_ptr_int;
2170
(((sessionvar_int_t *)opt)->resolve)= mysql_sys_var_ptr_int;
2418
2172
case PLUGIN_VAR_LONG:
2419
(((thdvar_long_t *)opt)->resolve)= mysql_sys_var_ptr_long;
2173
(((sessionvar_long_t *)opt)->resolve)= mysql_sys_var_ptr_long;
2421
2175
case PLUGIN_VAR_LONGLONG:
2422
(((thdvar_int64_t_t *)opt)->resolve)= mysql_sys_var_ptr_int64_t;
2176
(((sessionvar_int64_t_t *)opt)->resolve)= mysql_sys_var_ptr_int64_t;
2424
2178
case PLUGIN_VAR_STR:
2425
(((thdvar_str_t *)opt)->resolve)= mysql_sys_var_ptr_str;
2179
(((sessionvar_str_t *)opt)->resolve)= mysql_sys_var_ptr_str;
2427
2181
case PLUGIN_VAR_ENUM:
2428
(((thdvar_enum_t *)opt)->resolve)= mysql_sys_var_ptr_enum;
2182
(((sessionvar_enum_t *)opt)->resolve)= mysql_sys_var_ptr_enum;
2430
2184
case PLUGIN_VAR_SET:
2431
(((thdvar_set_t *)opt)->resolve)= mysql_sys_var_ptr_set;
2185
(((sessionvar_set_t *)opt)->resolve)= mysql_sys_var_ptr_set;
2434
sql_print_error(_("Unknown variable type code 0x%x in plugin '%s'."),
2188
errmsg_printf(ERRMSG_LVL_ERROR, _("Unknown variable type code 0x%x in plugin '%s'."),
2435
2189
opt->flags, plugin_name);