mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
5.5 merge and fixes for compiler/test errors
This commit is contained in:
@ -175,8 +175,7 @@ static struct
|
||||
|
||||
/* we disable few other plugins by default */
|
||||
{ "ndbcluster", PLUGIN_OFF },
|
||||
{ "feedback", PLUGIN_OFF },
|
||||
{ "pbxt", PLUGIN_OFF }
|
||||
{ "feedback", PLUGIN_OFF }
|
||||
};
|
||||
|
||||
/* support for Services */
|
||||
@ -690,6 +689,8 @@ static my_bool read_maria_plugin_info(struct st_plugin_dl *plugin_dl,
|
||||
sym= cur;
|
||||
plugin_dl->allocated= true;
|
||||
}
|
||||
else
|
||||
sym= ptr;
|
||||
}
|
||||
plugin_dl->plugins= (struct st_maria_plugin *)sym;
|
||||
|
||||
@ -2437,6 +2438,7 @@ typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_longlong_t, longlong);
|
||||
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_uint_t, uint);
|
||||
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_ulong_t, ulong);
|
||||
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_ulonglong_t, ulonglong);
|
||||
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_double_t, double);
|
||||
|
||||
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_int_t, int);
|
||||
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_long_t, long);
|
||||
@ -2444,6 +2446,7 @@ typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_longlong_t, longlong);
|
||||
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_uint_t, uint);
|
||||
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_ulong_t, ulong);
|
||||
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_ulonglong_t, ulonglong);
|
||||
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_double_t, double);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
@ -2659,6 +2662,20 @@ err:
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int check_func_double(THD *thd, struct st_mysql_sys_var *var,
|
||||
void *save, st_mysql_value *value)
|
||||
{
|
||||
double v;
|
||||
my_bool fixed;
|
||||
struct my_option option;
|
||||
|
||||
value->val_real(value, &v);
|
||||
plugin_opt_set_limits(&option, var);
|
||||
*(double *) save= getopt_double_limit_value(v, &option, &fixed);
|
||||
|
||||
return throw_bounds_warning(thd, var->name, fixed, v);
|
||||
}
|
||||
|
||||
|
||||
static void update_func_bool(THD *thd, struct st_mysql_sys_var *var,
|
||||
void *tgt, const void *save)
|
||||
@ -2691,15 +2708,25 @@ static void update_func_longlong(THD *thd, struct st_mysql_sys_var *var,
|
||||
static void update_func_str(THD *thd, struct st_mysql_sys_var *var,
|
||||
void *tgt, const void *save)
|
||||
{
|
||||
char *old= *(char **) tgt;
|
||||
*(char **)tgt= *(char **) save;
|
||||
char *value= *(char**) save;
|
||||
if (var->flags & PLUGIN_VAR_MEMALLOC)
|
||||
{
|
||||
*(char **)tgt= my_strdup(*(char **) save, MYF(0));
|
||||
char *old= *(char**) tgt;
|
||||
if (value)
|
||||
*(char**) tgt= my_strdup(value, MYF(0));
|
||||
else
|
||||
*(char**) tgt= 0;
|
||||
my_free(old);
|
||||
}
|
||||
else
|
||||
*(char**) tgt= value;
|
||||
}
|
||||
|
||||
static void update_func_double(THD *thd, struct st_mysql_sys_var *var,
|
||||
void *tgt, const void *save)
|
||||
{
|
||||
*(double *) tgt= *(double *) save;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
System Variables support
|
||||
@ -2814,6 +2841,9 @@ static st_bookmark *register_var(const char *plugin, const char *name,
|
||||
case PLUGIN_VAR_STR:
|
||||
size= sizeof(char*);
|
||||
break;
|
||||
case PLUGIN_VAR_DOUBLE:
|
||||
size= sizeof(double);
|
||||
break;
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
return NULL;
|
||||
@ -3026,6 +3056,11 @@ static char **mysql_sys_var_str(THD* thd, int offset)
|
||||
return (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);
|
||||
}
|
||||
|
||||
void plugin_thdvar_init(THD *thd)
|
||||
{
|
||||
plugin_ref old_table_plugin= thd->variables.table_plugin;
|
||||
@ -3178,6 +3213,8 @@ static SHOW_TYPE pluginvar_show_type(st_mysql_sys_var *plugin_var)
|
||||
case PLUGIN_VAR_ENUM:
|
||||
case PLUGIN_VAR_SET:
|
||||
return SHOW_CHAR;
|
||||
case PLUGIN_VAR_DOUBLE:
|
||||
return SHOW_DOUBLE;
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
return SHOW_UNDEF;
|
||||
@ -3198,6 +3235,8 @@ bool sys_var_pluginvar::check_update_type(Item_result type)
|
||||
case PLUGIN_VAR_BOOL:
|
||||
case PLUGIN_VAR_SET:
|
||||
return type != STRING_RESULT && type != INT_RESULT;
|
||||
case PLUGIN_VAR_DOUBLE:
|
||||
return type != INT_RESULT && type != REAL_RESULT && type != DECIMAL_RESULT;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
@ -3316,6 +3355,9 @@ bool sys_var_pluginvar::global_update(THD *thd, set_var *var)
|
||||
case PLUGIN_VAR_STR:
|
||||
src= &((sysvar_str_t*) plugin_var)->def_val;
|
||||
break;
|
||||
case PLUGIN_VAR_DOUBLE:
|
||||
src= &((sysvar_double_t*) plugin_var)->def_val;
|
||||
break;
|
||||
case PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL:
|
||||
src= &((thdvar_uint_t*) plugin_var)->def_val;
|
||||
break;
|
||||
@ -3337,6 +3379,9 @@ bool sys_var_pluginvar::global_update(THD *thd, set_var *var)
|
||||
case PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL:
|
||||
src= &((thdvar_str_t*) plugin_var)->def_val;
|
||||
break;
|
||||
case PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL:
|
||||
src= &((thdvar_double_t*) plugin_var)->def_val;
|
||||
break;
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
}
|
||||
@ -3354,6 +3399,13 @@ bool sys_var_pluginvar::global_update(THD *thd, set_var *var)
|
||||
options->max_value= (opt)->max_val; \
|
||||
options->block_size= (long) (opt)->blk_sz
|
||||
|
||||
#define OPTION_SET_LIMITS_DOUBLE(options, opt) \
|
||||
options->var_type= GET_DOUBLE; \
|
||||
options->def_value= (longlong) getopt_double2ulonglong((opt)->def_val); \
|
||||
options->min_value= (longlong) getopt_double2ulonglong((opt)->min_val); \
|
||||
options->max_value= getopt_double2ulonglong((opt)->max_val); \
|
||||
options->block_size= (long) (opt)->blk_sz;
|
||||
|
||||
|
||||
void plugin_opt_set_limits(struct my_option *options,
|
||||
const struct st_mysql_sys_var *opt)
|
||||
@ -3404,6 +3456,9 @@ void plugin_opt_set_limits(struct my_option *options,
|
||||
GET_STR_ALLOC : GET_STR);
|
||||
options->def_value= (intptr) ((sysvar_str_t*) opt)->def_val;
|
||||
break;
|
||||
case PLUGIN_VAR_DOUBLE:
|
||||
OPTION_SET_LIMITS_DOUBLE(options, (sysvar_double_t*) opt);
|
||||
break;
|
||||
/* threadlocal variables */
|
||||
case PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL:
|
||||
OPTION_SET_LIMITS(GET_INT, options, (thdvar_int_t*) opt);
|
||||
@ -3423,6 +3478,9 @@ void plugin_opt_set_limits(struct my_option *options,
|
||||
case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL:
|
||||
OPTION_SET_LIMITS(GET_ULL, options, (thdvar_ulonglong_t*) opt);
|
||||
break;
|
||||
case PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL:
|
||||
OPTION_SET_LIMITS_DOUBLE(options, (thdvar_double_t*) opt);
|
||||
break;
|
||||
case PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL:
|
||||
options->var_type= GET_ENUM;
|
||||
options->typelib= ((thdvar_enum_t*) opt)->typelib;
|
||||
@ -3574,6 +3632,9 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
|
||||
case PLUGIN_VAR_SET:
|
||||
((thdvar_set_t *) opt)->resolve= mysql_sys_var_ulonglong;
|
||||
break;
|
||||
case PLUGIN_VAR_DOUBLE:
|
||||
((thdvar_double_t *) opt)->resolve= mysql_sys_var_double;
|
||||
break;
|
||||
default:
|
||||
sql_print_error("Unknown variable type code 0x%x in plugin '%s'.",
|
||||
opt->flags, plugin_name);
|
||||
@ -3637,6 +3698,12 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
|
||||
if (!opt->update)
|
||||
opt->update= update_func_longlong;
|
||||
break;
|
||||
case PLUGIN_VAR_DOUBLE:
|
||||
if (!opt->check)
|
||||
opt->check= check_func_double;
|
||||
if (!opt->update)
|
||||
opt->update= update_func_double;
|
||||
break;
|
||||
default:
|
||||
sql_print_error("Unknown variable type code 0x%x in plugin '%s'.",
|
||||
opt->flags, plugin_name);
|
||||
|
Reference in New Issue
Block a user