← Back to team overview

maria-developers team mailing list archive

bzr commit into MariaDB 5.1, with Maria 1.5:maria branch (sanja:2712) Bug#45632

 

#At lp:maria

 2712 sanja@xxxxxxxxxxxx	2009-06-25
      Fix of BUG#45632 (http://bugs.mysql.com/bug.php?id=45632) - sharing non default debug settings between sessions. This bugfix proposed by Monty.
      modified:
        mysql-test/r/variables_debug.result
        mysql-test/t/variables_debug.test
        sql/set_var.cc

per-file messages:
  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.
=== modified file 'mysql-test/r/variables_debug.result'
--- a/mysql-test/r/variables_debug.result	2008-02-26 15:03:59 +0000
+++ b/mysql-test/r/variables_debug.result	2009-06-24 22:22:20 +0000
@@ -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

=== modified file 'mysql-test/t/variables_debug.test'
--- a/mysql-test/t/variables_debug.test	2008-02-26 15:03:59 +0000
+++ b/mysql-test/t/variables_debug.test	2009-06-24 22:22:20 +0000
@@ -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;
+

=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc	2009-05-19 09:28:05 +0000
+++ b/sql/set_var.cc	2009-06-24 22:22:20 +0000
@@ -4231,11 +4231,28 @@ bool sys_var_thd_dbug::check(THD *thd, s
 
 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)
-    DBUG_SET_INITIAL(var ? var->value->str_value.c_ptr() : "");
+    DBUG_SET_INITIAL(command);
   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;
 }
 




Follow ups