Commit 7bb3501f authored by unknown's avatar unknown

sql_plugin.cc:

  fixed uninit memory access in SET pluginvar=DEFAULT
innodb_mysql.test, innodb_mysql.result:
  test case for SET pluginvar=DEFAULT


mysql-test/r/innodb_mysql.result:
  test case for SET pluginvar=DEFAULT
mysql-test/t/innodb_mysql.test:
  test case for SET pluginvar=DEFAULT
sql/sql_plugin.cc:
  fixed uninit memory access in SET pluginvar=DEFAULT
parent 85e96bf8
set global innodb_support_xa=default;
set session innodb_support_xa=default;
SET SESSION STORAGE_ENGINE = InnoDB; SET SESSION STORAGE_ENGINE = InnoDB;
drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4; drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4;
create table t1 ( create table t1 (
......
...@@ -10,5 +10,6 @@ let $engine_type= InnoDB; ...@@ -10,5 +10,6 @@ let $engine_type= InnoDB;
let $other_engine_type= MEMORY; let $other_engine_type= MEMORY;
# InnoDB does support FOREIGN KEYFOREIGN KEYs # InnoDB does support FOREIGN KEYFOREIGN KEYs
let $test_foreign_keys= 1; let $test_foreign_keys= 1;
set global innodb_support_xa=default;
set session innodb_support_xa=default;
--source include/mix1.inc --source include/mix1.inc
...@@ -181,6 +181,7 @@ public: ...@@ -181,6 +181,7 @@ public:
TYPELIB* plugin_var_typelib(void); TYPELIB* plugin_var_typelib(void);
uchar* value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); uchar* value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
bool check_default(enum_var_type type) { return is_readonly(); }
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
}; };
...@@ -2168,9 +2169,11 @@ static st_bookmark *register_var(const char *plugin, const char *name, ...@@ -2168,9 +2169,11 @@ static st_bookmark *register_var(const char *plugin, const char *name,
size= sizeof(int); size= sizeof(int);
break; break;
case PLUGIN_VAR_LONG: case PLUGIN_VAR_LONG:
case PLUGIN_VAR_ENUM:
size= sizeof(long); size= sizeof(long);
break; break;
case PLUGIN_VAR_LONGLONG: case PLUGIN_VAR_LONGLONG:
case PLUGIN_VAR_SET:
size= sizeof(ulonglong); size= sizeof(ulonglong);
break; break;
case PLUGIN_VAR_STR: case PLUGIN_VAR_STR:
...@@ -2611,6 +2614,7 @@ void sys_var_pluginvar::set_default(THD *thd, enum_var_type type) ...@@ -2611,6 +2614,7 @@ void sys_var_pluginvar::set_default(THD *thd, enum_var_type type)
if (is_readonly()) if (is_readonly())
return; return;
pthread_mutex_lock(&LOCK_global_system_variables);
tgt= real_value_ptr(thd, type); tgt= real_value_ptr(thd, type);
src= ((void **) (plugin_var + 1) + 1); src= ((void **) (plugin_var + 1) + 1);
...@@ -2627,12 +2631,14 @@ void sys_var_pluginvar::set_default(THD *thd, enum_var_type type) ...@@ -2627,12 +2631,14 @@ void sys_var_pluginvar::set_default(THD *thd, enum_var_type type)
if (!(plugin_var->flags & PLUGIN_VAR_THDLOCAL) || type == OPT_GLOBAL) if (!(plugin_var->flags & PLUGIN_VAR_THDLOCAL) || type == OPT_GLOBAL)
{ {
pthread_mutex_lock(&LOCK_plugin);
plugin_var->update(thd, plugin_var, tgt, src); plugin_var->update(thd, plugin_var, tgt, src);
pthread_mutex_unlock(&LOCK_plugin); pthread_mutex_unlock(&LOCK_global_system_variables);
} }
else else
{
pthread_mutex_unlock(&LOCK_global_system_variables);
plugin_var->update(thd, plugin_var, tgt, src); plugin_var->update(thd, plugin_var, tgt, src);
}
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment