mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-7499 - System variables have broken default values on big endian
INFORMATION_SCHEMA.SYSTEM_VARIABLES.DEFAULT_VALUE had broken values on big endian. Default value is internally stored as longlong, while I_S references it's pointer (longlong *) according to variable type (e.g. int, my_bool, etc). This works well on little endian, but on big endian we always get 0 for such variables.
This commit is contained in:
@ -3253,7 +3253,31 @@ sys_var_pluginvar::sys_var_pluginvar(sys_var_chain *chain, const char *name_arg,
|
||||
uchar* sys_var_pluginvar::real_value_ptr(THD *thd, enum_var_type type)
|
||||
{
|
||||
if (type == OPT_DEFAULT)
|
||||
return (uchar*)&option.def_value;
|
||||
{
|
||||
switch (plugin_var->flags & PLUGIN_VAR_TYPEMASK) {
|
||||
case PLUGIN_VAR_BOOL:
|
||||
thd->sys_var_tmp.my_bool_value= option.def_value;
|
||||
return (uchar*) &thd->sys_var_tmp.my_bool_value;
|
||||
case PLUGIN_VAR_INT:
|
||||
thd->sys_var_tmp.int_value= option.def_value;
|
||||
return (uchar*) &thd->sys_var_tmp.int_value;
|
||||
case PLUGIN_VAR_LONG:
|
||||
case PLUGIN_VAR_ENUM:
|
||||
thd->sys_var_tmp.long_value= option.def_value;
|
||||
return (uchar*) &thd->sys_var_tmp.long_value;
|
||||
case PLUGIN_VAR_LONGLONG:
|
||||
case PLUGIN_VAR_SET:
|
||||
return (uchar*) &option.def_value;
|
||||
case PLUGIN_VAR_STR:
|
||||
thd->sys_var_tmp.ptr_value= (void*) option.def_value;
|
||||
return (uchar*) &thd->sys_var_tmp.ptr_value;
|
||||
case PLUGIN_VAR_DOUBLE:
|
||||
thd->sys_var_tmp.double_value= getopt_ulonglong2double(option.def_value);
|
||||
return (uchar*) &thd->sys_var_tmp.double_value;
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
DBUG_ASSERT(thd || (type == OPT_GLOBAL));
|
||||
if (plugin_var->flags & PLUGIN_VAR_THDLOCAL)
|
||||
|
Reference in New Issue
Block a user