Commit c40d85c6 authored by unknown's avatar unknown

Fix of BUG#45632 (http://bugs.mysql.com/bug.php?id=45632) - sharing non...

Fix of BUG#45632 (http://bugs.mysql.com/bug.php?id=45632) - sharing non default debug settings between sessions. This bugfix proposed by Monty.

mysql-test/r/variables_debug.result:
  Test that sessions do not share the same session debug variable.
mysql-test/t/variables_debug.test:
  Test that sessions do not share the same session debug variable.
sql/set_var.cc:
  As soon as default setting are shared between sessions we should push dbug state before changing debug setting first time.
parent 1f81aa5f
...@@ -10,3 +10,18 @@ set debug= '-P'; ...@@ -10,3 +10,18 @@ set debug= '-P';
select @@debug; select @@debug;
@@debug @@debug
T T
set session debug="t";
show session variables like 'debug';
Variable_name Value
debug t
set session debug="t";
show session variables like 'debug';
Variable_name Value
debug t
set session debug="d:t";
show session variables like 'debug';
Variable_name Value
debug d:t
show session variables like 'debug';
Variable_name Value
debug t
...@@ -10,3 +10,31 @@ set debug= '+P'; ...@@ -10,3 +10,31 @@ set debug= '+P';
select @@debug; select @@debug;
set debug= '-P'; set debug= '-P';
select @@debug; select @@debug;
#
# Checks that assigning variable 'debug' in one session has no influence on
# other session. (BUG#45632 of bugs.mysql.com)
#
connect(con1,localhost,root,,test,,);
connect(con2,localhost,root,,test,,);
# makes output independant of current debug status
connection con1;
set session debug="t";
show session variables like 'debug';
connection con2;
set session debug="t";
show session variables like 'debug';
# checks influence one session debug variable on another
connection con1;
set session debug="d:t";
show session variables like 'debug';
connection con2;
show session variables like 'debug';
disconnect con1;
disconnect con2;
connection default;
...@@ -4231,11 +4231,28 @@ bool sys_var_thd_dbug::check(THD *thd, set_var *var) ...@@ -4231,11 +4231,28 @@ bool sys_var_thd_dbug::check(THD *thd, set_var *var)
bool sys_var_thd_dbug::update(THD *thd, set_var *var) bool sys_var_thd_dbug::update(THD *thd, set_var *var)
{ {
#ifndef DBUG_OFF
const char *command= var ? var->value->str_value.c_ptr() : "";
if (var->type == OPT_GLOBAL) if (var->type == OPT_GLOBAL)
DBUG_SET_INITIAL(var ? var->value->str_value.c_ptr() : ""); DBUG_SET_INITIAL(command);
else else
DBUG_SET(var ? var->value->str_value.c_ptr() : ""); {
if (_db_is_pushed_())
{
/* We have already a local state done with DBUG_PUSH; Modify the state */
DBUG_SET(command);
}
else
{
/*
We are sharing the state with the global state;
Create a local state for this thread.
*/
DBUG_PUSH(command);
}
}
#endif
return 0; return 0;
} }
......
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