1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä
2025-01-20 09:57:37 +02:00
142 changed files with 3642 additions and 828 deletions

View File

@@ -3191,14 +3191,14 @@ void sync_dynamic_session_variables(THD* thd, bool global_lock)
If required, will sync with global variables if the requested variable
has not yet been allocated in the current thread.
*/
static uchar *intern_sys_var_ptr(THD* thd, int offset, bool global_lock)
static void *intern_sys_var_ptr(THD* thd, int offset, bool global_lock)
{
DBUG_ENTER("intern_sys_var_ptr");
DBUG_ASSERT(offset >= 0);
DBUG_ASSERT((uint)offset <= global_system_variables.dynamic_variables_head);
if (!thd)
DBUG_RETURN((uchar*) global_system_variables.dynamic_variables_ptr + offset);
DBUG_RETURN(global_system_variables.dynamic_variables_ptr + offset);
/*
dynamic_variables_head points to the largest valid offset
@@ -3210,7 +3210,7 @@ static uchar *intern_sys_var_ptr(THD* thd, int offset, bool global_lock)
sync_dynamic_session_variables(thd, global_lock);
mysql_prlock_unlock(&LOCK_system_variables_hash);
}
DBUG_RETURN((uchar*)thd->variables.dynamic_variables_ptr + offset);
DBUG_RETURN(thd->variables.dynamic_variables_ptr + offset);
}
@@ -3224,42 +3224,47 @@ static uchar *intern_sys_var_ptr(THD* thd, int offset, bool global_lock)
static char *mysql_sys_var_char(THD* thd, int offset)
{
return (char *) intern_sys_var_ptr(thd, offset, true);
return static_cast<char*>(intern_sys_var_ptr(thd, offset, true));
}
static int *mysql_sys_var_int(THD* thd, int offset)
{
return (int *) intern_sys_var_ptr(thd, offset, true);
return static_cast<int*>(intern_sys_var_ptr(thd, offset, true));
}
static unsigned int *mysql_sys_var_uint(THD* thd, int offset)
{
return static_cast<unsigned int*>(intern_sys_var_ptr(thd, offset, true));
}
static long *mysql_sys_var_long(THD* thd, int offset)
{
return (long *) intern_sys_var_ptr(thd, offset, true);
return static_cast<long*>(intern_sys_var_ptr(thd, offset, true));
}
static unsigned long *mysql_sys_var_ulong(THD* thd, int offset)
{
return (unsigned long *) intern_sys_var_ptr(thd, offset, true);
return static_cast<unsigned long*>(intern_sys_var_ptr(thd, offset, true));
}
static long long *mysql_sys_var_longlong(THD* thd, int offset)
{
return (long long *) intern_sys_var_ptr(thd, offset, true);
return static_cast<long long*>(intern_sys_var_ptr(thd, offset, true));
}
static unsigned long long *mysql_sys_var_ulonglong(THD* thd, int offset)
{
return (unsigned long long *) intern_sys_var_ptr(thd, offset, true);
return static_cast<unsigned long long*>(intern_sys_var_ptr(thd, offset, true));
}
static char **mysql_sys_var_str(THD* thd, int offset)
{
return (char **) intern_sys_var_ptr(thd, offset, true);
return static_cast<char**>(intern_sys_var_ptr(thd, offset, true));
}
static double *mysql_sys_var_double(THD* thd, int offset)
{
return (double *) intern_sys_var_ptr(thd, offset, true);
return static_cast<double*>(intern_sys_var_ptr(thd, offset, true));
}
void plugin_thdvar_init(THD *thd)
@@ -3520,7 +3525,7 @@ uchar* sys_var_pluginvar::real_value_ptr(THD *thd, enum_var_type type) const
if (type == OPT_GLOBAL)
thd= NULL;
return intern_sys_var_ptr(thd, *(int*) (plugin_var+1), false);
return (uchar*) intern_sys_var_ptr(thd, *(int*) (plugin_var+1), false);
}
return *(uchar**) (plugin_var+1);
}
@@ -3529,8 +3534,8 @@ uchar* sys_var_pluginvar::real_value_ptr(THD *thd, enum_var_type type) const
bool sys_var_pluginvar::session_is_default(THD *thd)
{
uchar *value= plugin_var->flags & PLUGIN_VAR_THDLOCAL
? intern_sys_var_ptr(thd, *(int*) (plugin_var+1), true)
: *(uchar**) (plugin_var+1);
? static_cast<uchar*>(intern_sys_var_ptr(thd, *(int*) (plugin_var+1), true))
: *reinterpret_cast<uchar**>(plugin_var+1);
real_value_ptr(thd, OPT_SESSION);
@@ -3772,27 +3777,27 @@ void plugin_opt_set_limits(struct my_option *options,
break;
case PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL:
options->var_type= GET_ENUM;
options->typelib= ((thdvar_enum_t*) opt)->typelib;
options->def_value= ((thdvar_enum_t*) opt)->def_val;
options->typelib= reinterpret_cast<const thdvar_enum_t*>(opt)->typelib;
options->def_value= reinterpret_cast<const thdvar_enum_t*>(opt)->def_val;
options->min_value= options->block_size= 0;
options->max_value= options->typelib->count - 1;
break;
case PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL:
options->var_type= GET_SET;
options->typelib= ((thdvar_set_t*) opt)->typelib;
options->def_value= ((thdvar_set_t*) opt)->def_val;
options->typelib= reinterpret_cast<const thdvar_set_t*>(opt)->typelib;
options->def_value= reinterpret_cast<const thdvar_set_t*>(opt)->def_val;
options->min_value= options->block_size= 0;
options->max_value= (1ULL << options->typelib->count) - 1;
break;
case PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL:
options->var_type= GET_BOOL;
options->def_value= ((thdvar_bool_t*) opt)->def_val;
options->def_value= reinterpret_cast<const thdvar_bool_t*>(opt)->def_val;
options->typelib= &bool_typelib;
break;
case PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL:
options->var_type= ((opt->flags & PLUGIN_VAR_MEMALLOC) ?
GET_STR_ALLOC : GET_STR);
options->def_value= (intptr) ((thdvar_str_t*) opt)->def_val;
options->def_value= reinterpret_cast<intptr_t>(reinterpret_cast<const thdvar_str_t*>(opt)->def_val);
break;
default:
DBUG_ASSERT(0);
@@ -3831,7 +3836,7 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
size_t plugin_name_len= strlen(plugin_name);
size_t optnamelen;
const int max_comment_len= 255;
char *comment= (char *) alloc_root(mem_root, max_comment_len + 1);
char *comment= static_cast<char*>(alloc_root(mem_root, max_comment_len + 1));
char *optname;
int index= 0, UNINIT_VAR(offset);
@@ -3843,7 +3848,7 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
DBUG_ENTER("construct_options");
plugin_name_ptr= (char*) alloc_root(mem_root, plugin_name_len + 1);
plugin_name_ptr= static_cast<char*>(alloc_root(mem_root, plugin_name_len + 1));
safe_strcpy(plugin_name_ptr, plugin_name_len + 1, plugin_name);
my_casedn_str(&my_charset_latin1, plugin_name_ptr);
convert_underscore_to_dash(plugin_name_ptr, plugin_name_len);
@@ -3902,19 +3907,28 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
continue;
if (!(register_var(plugin_name_ptr, opt->name, opt->flags)))
continue;
switch (opt->flags & PLUGIN_VAR_TYPEMASK) {
switch (opt->flags & (PLUGIN_VAR_TYPEMASK | PLUGIN_VAR_UNSIGNED)) {
case PLUGIN_VAR_BOOL:
((thdvar_bool_t *) opt)->resolve= mysql_sys_var_char;
break;
case PLUGIN_VAR_INT:
((thdvar_int_t *) opt)->resolve= mysql_sys_var_int;
break;
case PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED:
((thdvar_uint_t *) opt)->resolve= mysql_sys_var_uint;
break;
case PLUGIN_VAR_LONG:
((thdvar_long_t *) opt)->resolve= mysql_sys_var_long;
break;
case PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED:
((thdvar_ulong_t *) opt)->resolve= mysql_sys_var_ulong;
break;
case PLUGIN_VAR_LONGLONG:
((thdvar_longlong_t *) opt)->resolve= mysql_sys_var_longlong;
break;
case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED:
((thdvar_ulonglong_t *) opt)->resolve= mysql_sys_var_ulonglong;
break;
case PLUGIN_VAR_STR:
((thdvar_str_t *) opt)->resolve= mysql_sys_var_str;
break;