Below is the list of changes that have just been committed into a local
5.0 repository of antony. When antony 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
1.2019 05/10/05 17:28:31 acurtis@stripped +4 -0
Bug#13305
"multi-table update crashes slave if involves function"
Don't call mysql_multi_update_prepare twice
sql/sql_update.cc
1.173 05/10/05 17:28:01 acurtis@stripped +2 -1
fix bug 13305, don't call mysql_multi_update_prepare twice.
sql/sql_parse.cc
1.500 05/10/05 17:28:00 acurtis@stripped +1 -21
remove the fake_lock junk
mysql-test/t/rpl_multi_update.test
1.11 05/10/05 17:28:00 acurtis@stripped +27 -0
test for bug 13305
mysql-test/r/rpl_multi_update.result
1.8 05/10/05 17:27:59 acurtis@stripped +12 -0
test for bug 13305
# 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: acurtis
# Host: ltantony
# Root: /usr/home/antony/work2/p2-bug13305.1
--- 1.499/sql/sql_parse.cc 2005-10-05 10:58:04 -07:00
+++ 1.500/sql/sql_parse.cc 2005-10-05 17:28:00 -07:00
@@ -2317,8 +2317,6 @@
LEX *lex= thd->lex;
/* first SELECT_LEX (have special meaning for many of non-SELECTcommands) */
SELECT_LEX *select_lex= &lex->select_lex;
- bool slave_fake_lock= 0;
- MYSQL_LOCK *fake_prev_lock= 0;
/* first table of first SELECT_LEX */
TABLE_LIST *first_table= (TABLE_LIST*) select_lex->table_list.first;
/* list of all tables in query */
@@ -2369,19 +2367,9 @@
{
if (lex->sql_command == SQLCOM_UPDATE_MULTI)
{
- DBUG_PRINT("info",("need faked locked tables"));
-
+ /* Fix for replication, perform locking early */
if (check_multi_update_lock(thd))
goto error;
-
- /* Fix for replication, the tables are opened and locked,
- now we pretend that we have performed a LOCK TABLES action */
-
- fake_prev_lock= thd->locked_tables;
- if (thd->lock)
- thd->locked_tables= thd->lock;
- thd->lock= 0;
- slave_fake_lock= 1;
}
/*
Skip if we are in the slave thread, some table rules have been
@@ -4774,14 +4762,6 @@
res= 1;
cleanup:
- if (unlikely(slave_fake_lock))
- {
- DBUG_PRINT("info",("undoing faked lock"));
- thd->lock= thd->locked_tables;
- thd->locked_tables= fake_prev_lock;
- if (thd->lock == thd->locked_tables)
- thd->lock= 0;
- }
DBUG_RETURN(res || thd->net.report_error);
}
--- 1.172/sql/sql_update.cc 2005-09-28 02:28:37 -07:00
+++ 1.173/sql/sql_update.cc 2005-10-05 17:28:01 -07:00
@@ -841,7 +841,8 @@
multi_update *result;
DBUG_ENTER("mysql_multi_update");
- if (mysql_multi_update_prepare(thd))
+ /* We don't want to call mysql_multi_update_prepare a 2nd time */
+ if (!thd->slave_thread && mysql_multi_update_prepare(thd))
DBUG_RETURN(TRUE);
if (!(result= new multi_update(table_list,
--- 1.7/mysql-test/r/rpl_multi_update.result 2005-09-20 08:41:42 -07:00
+++ 1.8/mysql-test/r/rpl_multi_update.result 2005-10-05 17:27:59 -07:00
@@ -37,3 +37,15 @@
a b
1 1
drop table t1, t2;
+create table t1(a int);
+insert into t1 values (1),(2);
+create table t2(a int);
+insert into t2 values (1),(2);
+create table t3 (a int);
+create function f1(a int) returns int deterministic modifies sql data
+begin
+insert into t3 values(a);
+return 0;
+end//
+update t1,t2 set t1.a=3, t2.a=3 where f1(t1.a) = 0;
+drop table t1, t2;
--- 1.10/mysql-test/t/rpl_multi_update.test 2005-09-23 05:59:11 -07:00
+++ 1.11/mysql-test/t/rpl_multi_update.test 2005-10-05 17:28:00 -07:00
@@ -47,3 +47,30 @@
connection master;
drop table t1, t2;
sync_slave_with_master;
+
+#
+# Bug#13305 multi-table update crashes slave if involves function
+#
+connection master;
+create table t1(a int);
+insert into t1 values (1),(2);
+create table t2(a int);
+insert into t2 values (1),(2);
+
+create table t3 (a int);
+delimiter //;
+
+create function f1(a int) returns int deterministic modifies sql data
+begin
+ insert into t3 values(a);
+ return 0;
+end//
+
+delimiter ;//
+
+# test for crash
+update t1,t2 set t1.a=3, t2.a=3 where f1(t1.a) = 0;
+sync_slave_with_master;
+
+connection master;
+drop table t1, t2;
| Thread |
|---|
| • bk commit into 5.0 tree (acurtis:1.2019) BUG#13305 | antony | 6 Oct |