Below is the list of changes that have just been committed into a local
5.0 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:30:44-05:00, cbell@mysql_cab_desk. +5 -0
Merge cbell@stripped:/home/bk/mysql-5.0-rpl
into mysql_cab_desk.:C:/source/c++/mysql-5.0-rpl
MERGE: 1.2341.85.1
sql/item_func.cc@stripped, 2007-02-26 14:30:36-05:00, cbell@mysql_cab_desk. +0 -0
Auto merged
MERGE: 1.317.5.1
sql/log.cc@stripped, 2007-02-26 14:30:36-05:00, cbell@mysql_cab_desk. +0 -0
Auto merged
MERGE: 1.200.1.2
sql/sp_head.cc@stripped, 2007-02-26 14:30:36-05:00, cbell@mysql_cab_desk. +0 -0
Auto merged
MERGE: 1.230.1.1
sql/sql_class.cc@stripped, 2007-02-26 14:30:37-05:00, cbell@mysql_cab_desk. +0 -0
Auto merged
MERGE: 1.256.2.1
sql/sql_class.h@stripped, 2007-02-26 14:30:37-05:00, cbell@mysql_cab_desk. +0 -0
Auto merged
MERGE: 1.316.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.0-rpl/RESYNC
--- 1.324/sql/item_func.cc 2007-02-26 14:30:58 -05:00
+++ 1.325/sql/item_func.cc 2007-02-26 14:30:58 -05:00
@@ -4227,7 +4227,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 the execution of the
+ calling statement. We must log all such variables even if they are
+ not involved in table-updating statements.
+ */
+ if (!(opt_bin_log &&
+ (is_update_query(sql_command) || thd->in_sub_stmt)))
{
*out_entry= var_entry;
return 0;
--- 1.203/sql/log.cc 2007-02-26 14:30:58 -05:00
+++ 1.204/sql/log.cc 2007-02-26 14:30:58 -05:00
@@ -1578,13 +1578,13 @@
return err;
}
-void MYSQL_LOG::start_union_events(THD *thd)
+void MYSQL_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_LOG::stop_union_events(THD *thd)
--- 1.259/sql/sql_class.cc 2007-02-26 14:30:58 -05:00
+++ 1.260/sql/sql_class.cc 2007-02-26 14:30:58 -05:00
@@ -2050,6 +2050,10 @@
if (!lex->requires_prelocking() || is_update_query(lex->sql_command))
options&= ~OPTION_BIN_LOG;
+
+ if ((backup->options & OPTION_BIN_LOG) && is_update_query(lex->sql_command))
+ mysql_bin_log.start_union_events(this, this->query_id);
+
/* Disable result sets */
client_capabilities &= ~CLIENT_MULTI_RESULTS;
in_sub_stmt|= new_state;
@@ -2095,6 +2099,9 @@
limit_found_rows= backup->limit_found_rows;
sent_row_count= backup->sent_row_count;
client_capabilities= backup->client_capabilities;
+
+ if ((options & OPTION_BIN_LOG) && is_update_query(lex->sql_command))
+ mysql_bin_log.stop_union_events(this);
/*
The following is added to the old values as we are interested in the
--- 1.319/sql/sql_class.h 2007-02-26 14:30:58 -05:00
+++ 1.320/sql/sql_class.h 2007-02-26 14:30:58 -05:00
@@ -311,7 +311,7 @@
bool write(Log_event* event_info); // binary log write
bool write(THD *thd, IO_CACHE *cache, Log_event *commit_event);
- 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.232/sql/sp_head.cc 2007-02-26 14:30:58 -05:00
+++ 1.233/sql/sp_head.cc 2007-02-26 14:30:58 -05:00
@@ -1462,8 +1462,24 @@
binlog_save_options= thd->options;
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);
}
/*
| Thread |
|---|
| • bk commit into 5.0 tree (cbell:1.2424) | cbell | 26 Feb |