Bug #30651 Problems with thread_handling system variable

Changed thread_handling variable to a global only, read only variable, as it is currently used.
parent 8651e9dd
...@@ -7,3 +7,7 @@ select 1+2; ...@@ -7,3 +7,7 @@ select 1+2;
SHOW GLOBAL VARIABLES LIKE 'thread_handling'; SHOW GLOBAL VARIABLES LIKE 'thread_handling';
Variable_name Value Variable_name Value
thread_handling no-threads thread_handling no-threads
select @@session.thread_handling;
ERROR HY000: Variable 'thread_handling' is a GLOBAL variable
set GLOBAL thread_handling='one-thread';
ERROR HY000: Variable 'thread_handling' is a read only variable
...@@ -4,3 +4,13 @@ ...@@ -4,3 +4,13 @@
select 1+1; select 1+1;
select 1+2; select 1+2;
SHOW GLOBAL VARIABLES LIKE 'thread_handling'; SHOW GLOBAL VARIABLES LIKE 'thread_handling';
#
# Bug #30651 Problems with thread_handling system variable
#
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.thread_handling;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set GLOBAL thread_handling='one-thread';
...@@ -384,7 +384,7 @@ static sys_var_thd_ulong sys_trans_alloc_block_size(&vars, "transaction_alloc_bl ...@@ -384,7 +384,7 @@ static sys_var_thd_ulong sys_trans_alloc_block_size(&vars, "transaction_alloc_bl
static sys_var_thd_ulong sys_trans_prealloc_size(&vars, "transaction_prealloc_size", static sys_var_thd_ulong sys_trans_prealloc_size(&vars, "transaction_prealloc_size",
&SV::trans_prealloc_size, &SV::trans_prealloc_size,
0, fix_trans_mem_root); 0, fix_trans_mem_root);
sys_var_thd_enum sys_thread_handling(&vars, "thread_handling", sys_var_enum_const sys_thread_handling(&vars, "thread_handling",
&SV::thread_handling, &SV::thread_handling,
&thread_handling_typelib, &thread_handling_typelib,
NULL); NULL);
...@@ -1183,6 +1183,13 @@ uchar *sys_var_enum::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) ...@@ -1183,6 +1183,13 @@ uchar *sys_var_enum::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
return (uchar*) enum_names->type_names[*value]; return (uchar*) enum_names->type_names[*value];
} }
uchar *sys_var_enum_const::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
return (uchar*) enum_names->type_names[global_system_variables.*offset];
}
bool sys_var_thd_ulong::check(THD *thd, set_var *var) bool sys_var_thd_ulong::check(THD *thd, set_var *var)
{ {
return (sys_var_thd::check(thd, var) || return (sys_var_thd::check(thd, var) ||
......
...@@ -305,6 +305,24 @@ class sys_var_enum :public sys_var ...@@ -305,6 +305,24 @@ class sys_var_enum :public sys_var
}; };
class sys_var_enum_const :public sys_var
{
ulong SV::*offset;
TYPELIB *enum_names;
public:
sys_var_enum_const(sys_var_chain *chain, const char *name_arg, ulong SV::*offset_arg,
TYPELIB *typelib, sys_after_update_func func)
:sys_var(name_arg,func), offset(offset_arg), enum_names(typelib)
{ chain_sys_var(chain); }
bool check(THD *thd, set_var *var) { return 1; }
bool update(THD *thd, set_var *var) { return 1; }
SHOW_TYPE show_type() { return SHOW_CHAR; }
bool check_update_type(Item_result type) { return 1; }
bool is_readonly() const { return 1; }
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
class sys_var_thd :public sys_var class sys_var_thd :public sys_var
{ {
public: public:
......
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