MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Luis Soares Date:February 17 2010 11:49am
Subject:bzr commit into mysql-5.1-rep+2 branch (luis.soares:3174) Bug#46364
View as plain text  
#At file:///home/lsoares/Workspace/bzr/work/MC/y10w5/mysql-5.1-rep%2B2-merge/ based on revid:luis.soares@stripped

 3174 Luis Soares	2010-02-17 [merge]
      BUG#46364: Fix for binlog.binlog_switch_inside_trans test failure 
                 in mysql-5.1-rep+2.
      
      Merged Alfranio's post-merge fix.

    modified:
      sql/set_var.cc
      sql/set_var.h
=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc	2010-02-12 23:30:44 +0000
+++ b/sql/set_var.cc	2010-02-17 07:58:43 +0000
@@ -208,8 +208,8 @@ static sys_var_long_ptr	sys_binlog_cache
 					      &binlog_cache_size);
 static sys_var_thd_binlog_format sys_binlog_format(&vars, "binlog_format",
                                             &SV::binlog_format);
-static sys_var_thd_bool sys_binlog_direct_non_trans_update(&vars, "binlog_direct_non_transactional_updates",
-                                                           &SV::binlog_direct_non_trans_update);
+static sys_var_thd_binlog_direct sys_binlog_direct_non_trans_update(&vars, "binlog_direct_non_transactional_updates",
+                                                                    &SV::binlog_direct_non_trans_update);
 static sys_var_thd_ulong	sys_bulk_insert_buff_size(&vars, "bulk_insert_buffer_size",
 						  &SV::bulk_insert_buff_size);
 static sys_var_const_os         sys_character_sets_dir(&vars,
@@ -1293,11 +1293,11 @@ bool sys_var_thd_binlog_format::check(TH
     return 1;
   }
   /*
-    All variables that affect writing to binary log (either format or
-    turning logging on and off) use the same checking. We call the
-    superclass ::check function to assign the variable correctly, and
-    then check the value.
-   */
+    All variables that affect writing to binary log (e.g. format, direct
+    write or turning logging on and off) use the same checking. We call
+    the superclass ::check function to assign the variable correctly,
+    and then check the value.
+  */
   bool result= sys_var_thd_enum::check(thd, var);
   if (!result)
     result= check_log_update(thd, var);
@@ -1323,6 +1323,51 @@ bool sys_var_thd_binlog_format::check(TH
   return result;
 }
 
+
+bool sys_var_thd_binlog_direct::check(THD *thd, set_var *var)
+{
+  /*
+    Make the session variable 'binlog_direct' read-only inside a transaction.
+  */
+  if (thd->active_transaction() && (var->type == OPT_SESSION))
+  {
+    my_error(ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT, MYF(0));
+    return 1;
+  }
+
+  /*
+    All variables that affect writing to binary log (e.g. format, direct
+    write or turning logging on and off) use the same checking. We call
+    the superclass ::check function to assign the variable correctly,
+    and then check the value.
+  */
+  bool result= sys_var_thd_bool::check(thd, var);
+  if (!result)
+    result= check_log_update(thd, var);
+ 
+  return result;
+}
+
+
+bool sys_var_thd_binlog_direct::is_readonly() const
+{
+  /*
+    Under certain circumstances, the variable is read-only (unchangeable):
+  */
+  THD *thd= current_thd;
+
+  /*
+    if in a stored function/trigger, it's too late to change mode
+  */
+  if (thd->in_sub_stmt)
+  {
+    my_error(ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT, MYF(0));
+    return 1;    
+  }
+
+  return sys_var_thd_bool::is_readonly();
+}
+
 bool sys_var_thd_binlog_format::is_readonly() const
 {
   /*

=== modified file 'sql/set_var.h'
--- a/sql/set_var.h	2009-12-15 20:21:00 +0000
+++ b/sql/set_var.h	2010-02-17 07:58:43 +0000
@@ -1273,6 +1273,16 @@ public:
   bool is_readonly() const;
 };
 
+class sys_var_thd_binlog_direct :public sys_var_thd_bool
+{
+public:
+  sys_var_thd_binlog_direct(sys_var_chain *chain, const char *name_arg,
+                            my_bool SV::*offset_arg)
+    :sys_var_thd_bool(chain, name_arg, offset_arg)
+  {};
+  bool check(THD *thd, set_var *var);
+  bool is_readonly() const;
+};
 /****************************************************************************
   Classes for parsing of the SET command
 ****************************************************************************/


Attachment: [text/bzr-bundle] bzr/luis.soares@sun.com-20100217114902-9qs8ll7ys3s9l53d.bundle
Thread
bzr commit into mysql-5.1-rep+2 branch (luis.soares:3174) Bug#46364Luis Soares17 Feb