summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorunknown <kostja@bodhi.local>2007-03-06 16:44:14 +0300
committerunknown <kostja@bodhi.local>2007-03-06 16:44:14 +0300
commitc155c66da65e3d19b2baec7d141648dfd9b55f52 (patch)
tree5ab59b0392a68db1b929fa51dcc17626e375132e /sql/sp_head.cc
parent198a8abd87e787c8dd9e92eedadd59b03dba257c (diff)
parent4268313e50e8ebe69e1baaef4d84f54c2764dfb1 (diff)
downloadmariadb-git-c155c66da65e3d19b2baec7d141648dfd9b55f52.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.1-new-rpl
into bodhi.local:/opt/local/work/mysql-5.1-runtime-merge mysql-test/t/disabled.def: Auto merged sql/handler.cc: Auto merged sql/item_func.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.h: Auto merged mysql-test/r/show_check.result: Manual merge. mysql-test/t/show_check.test: Manual merge.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 2f141068b70..20d45af7415 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1484,8 +1484,24 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
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= global_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;
}