mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
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.
This commit is contained in:
parent
1f81aa5f5a
commit
c40d85c634
3 changed files with 64 additions and 4 deletions
|
@ -10,3 +10,18 @@ set debug= '-P';
|
|||
select @@debug;
|
||||
@@debug
|
||||
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';
|
|||
select @@debug;
|
||||
set debug= '-P';
|
||||
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)
|
|||
|
||||
bool sys_var_thd_dbug::update(THD *thd, set_var *var)
|
||||
{
|
||||
if (var->type == OPT_GLOBAL)
|
||||
DBUG_SET_INITIAL(var ? var->value->str_value.c_ptr() : "");
|
||||
else
|
||||
DBUG_SET(var ? var->value->str_value.c_ptr() : "");
|
||||
#ifndef DBUG_OFF
|
||||
const char *command= var ? var->value->str_value.c_ptr() : "";
|
||||
|
||||
if (var->type == OPT_GLOBAL)
|
||||
DBUG_SET_INITIAL(command);
|
||||
else
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue