List:Commits« Previous MessageNext Message »
From:cbell Date:February 26 2007 7:34pm
Subject:bk commit into 5.1 tree (cbell:1.2462)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of cbell. When cbell does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-02-26 14:33:58-05:00, cbell@mysql_cab_desk. +5 -0
  Merge cbell@stripped:/home/bk/mysql-5.1-new-rpl
  into  mysql_cab_desk.:C:/source/C++/mysql-5.1-new-rpl
  MERGE: 1.2390.26.1

  sql/item_func.cc@stripped, 2007-02-26 14:33:49-05:00, cbell@mysql_cab_desk. +0 -0
    Auto merged
    MERGE: 1.347.3.1

  sql/log.cc@stripped, 2007-02-26 14:33:49-05:00, cbell@mysql_cab_desk. +0 -0
    Auto merged
    MERGE: 1.255.1.1

  sql/log.h@stripped, 2007-02-26 14:33:50-05:00, cbell@mysql_cab_desk. +0 -0
    Auto merged
    MERGE: 1.21.1.1

  sql/sp_head.cc@stripped, 2007-02-26 14:33:50-05:00, cbell@mysql_cab_desk. +0 -0
    Auto merged
    MERGE: 1.250.1.1

  sql/sql_class.cc@stripped, 2007-02-26 14:33:50-05:00, cbell@mysql_cab_desk. +0 -0
    Auto merged
    MERGE: 1.306.1.1

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	cbell
# Host:	mysql_cab_desk.
# Root:	C:/source/C++/mysql-5.1-new-rpl/RESYNC

--- 1.359/sql/item_func.cc	2007-02-26 14:34:12 -05:00
+++ 1.360/sql/item_func.cc	2007-02-26 14:34:12 -05:00
@@ -4220,7 +4220,14 @@
   user_var_entry *var_entry;
   var_entry= get_variable(&thd->user_vars, name, 0);
 
-  if (!(opt_bin_log && is_update_query(sql_command)))
+  /*
+    Any reference to user-defined variable which is done from stored
+    function or trigger affects their execution and execution of calling
+    statement. Hence we want to log all accesses to such variables and
+    not only those that happen from table-updating statement.
+  */
+  if (!(opt_bin_log && 
+       (is_update_query(sql_command) || thd->in_sub_stmt)))
   {
     *out_entry= var_entry;
     return 0;

--- 1.260/sql/log.cc	2007-02-26 14:34:12 -05:00
+++ 1.261/sql/log.cc	2007-02-26 14:34:12 -05:00
@@ -3345,13 +3345,13 @@
   return err;
 }
 
-void MYSQL_BIN_LOG::start_union_events(THD *thd)
+void MYSQL_BIN_LOG::start_union_events(THD *thd, query_id_t query_id_param)
 {
   DBUG_ASSERT(!thd->binlog_evt_union.do_union);
   thd->binlog_evt_union.do_union= TRUE;
   thd->binlog_evt_union.unioned_events= FALSE;
   thd->binlog_evt_union.unioned_events_trans= FALSE;
-  thd->binlog_evt_union.first_query_id= thd->query_id;
+  thd->binlog_evt_union.first_query_id= query_id_param;
 }
 
 void MYSQL_BIN_LOG::stop_union_events(THD *thd)

--- 1.315/sql/sql_class.cc	2007-02-26 14:34:12 -05:00
+++ 1.316/sql/sql_class.cc	2007-02-26 14:34:12 -05:00
@@ -2158,6 +2158,11 @@
   {
     options&= ~OPTION_BIN_LOG;
   }    
+
+  if ((backup->options & OPTION_BIN_LOG) && is_update_query(lex->sql_command)&&
+      !current_stmt_binlog_row_based)
+    mysql_bin_log.start_union_events(this, this->query_id);
+
   /* Disable result sets */
   client_capabilities &= ~CLIENT_MULTI_RESULTS;
   in_sub_stmt|= new_state;
@@ -2201,6 +2206,10 @@
   sent_row_count=   backup->sent_row_count;
   client_capabilities= backup->client_capabilities;
 
+  if ((options & OPTION_BIN_LOG) && is_update_query(lex->sql_command) &&
+    !current_stmt_binlog_row_based)
+    mysql_bin_log.stop_union_events(this);
+ 
   /*
     The following is added to the old values as we are interested in the
     total complexity of the query

--- 1.22/sql/log.h	2007-02-26 14:34:13 -05:00
+++ 1.23/sql/log.h	2007-02-26 14:34:13 -05:00
@@ -341,7 +341,7 @@
 
   int  write_cache(IO_CACHE *cache, bool lock_log, bool flush_and_sync);
 
-  void start_union_events(THD *thd);
+  void start_union_events(THD *thd, query_id_t query_id_param);
   void stop_union_events(THD *thd);
   bool is_query_in_union(THD *thd, query_id_t query_id_param);
 

--- 1.252/sql/sp_head.cc	2007-02-26 14:34:13 -05:00
+++ 1.253/sql/sp_head.cc	2007-02-26 14:34:13 -05:00
@@ -1482,8 +1482,24 @@
 
   if (need_binlog_call)
   {
+    query_id_t q;
     reset_dynamic(&thd->user_var_events);
-    mysql_bin_log.start_union_events(thd);
+    /*
+      In case of artificially constructed events for function calls
+      we have separate union for each such event and hence can't use
+      query_id of real calling statement as the start of all these
+      unions (this will break logic of replication of user-defined
+      variables). So we use artifical value which is guaranteed to
+      be greater than all query_id's of all statements belonging
+      to previous events/unions.
+      Possible alternative to this is logging of all function invocations
+      as one select and not resetting THD::user_var_events before
+      each invocation.
+    */
+    VOID(pthread_mutex_lock(&LOCK_thread_count));
+    q= ::query_id;
+    VOID(pthread_mutex_unlock(&LOCK_thread_count));
+    mysql_bin_log.start_union_events(thd, q + 1);
     binlog_save_options= thd->options;
     thd->options&= ~OPTION_BIN_LOG;
   }

Thread
bk commit into 5.1 tree (cbell:1.2462)cbell26 Feb