Loading mysql-test/r/rpl_multi_update2.result +13 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; drop table if exists t1,t2; CREATE TABLE t1 ( a int unsigned not null auto_increment primary key, b int unsigned Loading Loading @@ -40,3 +41,15 @@ SELECT * FROM t2 ORDER BY a; a b 1 0 2 1 drop table t1,t2; reset master; CREATE TABLE t1 ( a INT ); INSERT INTO t1 VALUES (0); UPDATE t1, (SELECT 3 as b) AS x SET t1.a = x.b; select * from t1; a 3 select * from t1; a 3 drop table t1; mysql-test/t/rpl_multi_update2.test +27 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,10 @@ source include/master-slave.inc; --disable_warnings drop table if exists t1,t2; --enable_warnings CREATE TABLE t1 ( a int unsigned not null auto_increment primary key, b int unsigned Loading Loading @@ -32,4 +36,27 @@ sync_with_master; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; connection master; drop table t1,t2; sync_slave_with_master; # # BUG#13236 multi-update with subquery & --replicate-ignore-table # reset master; connection master; CREATE TABLE t1 ( a INT ); INSERT INTO t1 VALUES (0); UPDATE t1, (SELECT 3 as b) AS x SET t1.a = x.b; select * from t1; sync_slave_with_master; connection slave; select * from t1; connection master; drop table t1; sync_slave_with_master; # End of 4.1 tests sql/sql_update.cc +6 −2 Original line number Diff line number Diff line Loading @@ -569,7 +569,9 @@ int mysql_multi_update_lock(THD *thd, } DBUG_PRINT("info",("setting table `%s` for update", tl->alias)); tl->lock_type= thd->lex->multi_lock_option; tl->updating= 1; tl->updating= 1; // loacal or only list if (tl->table_list) tl->table_list->updating= 1; // global list (if we have 2 lists) wants= UPDATE_ACL; } else Loading @@ -579,7 +581,9 @@ int mysql_multi_update_lock(THD *thd, // correct order of statements. Otherwise, we use a TL_READ lock to // improve performance. tl->lock_type= using_update_log ? TL_READ_NO_INSERT : TL_READ; tl->updating= 0; tl->updating= 0; // loacal or only list if (tl->table_list) tl->table_list->updating= 0; // global list (if we have 2 lists) wants= SELECT_ACL; } Loading Loading
mysql-test/r/rpl_multi_update2.result +13 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; drop table if exists t1,t2; CREATE TABLE t1 ( a int unsigned not null auto_increment primary key, b int unsigned Loading Loading @@ -40,3 +41,15 @@ SELECT * FROM t2 ORDER BY a; a b 1 0 2 1 drop table t1,t2; reset master; CREATE TABLE t1 ( a INT ); INSERT INTO t1 VALUES (0); UPDATE t1, (SELECT 3 as b) AS x SET t1.a = x.b; select * from t1; a 3 select * from t1; a 3 drop table t1;
mysql-test/t/rpl_multi_update2.test +27 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,10 @@ source include/master-slave.inc; --disable_warnings drop table if exists t1,t2; --enable_warnings CREATE TABLE t1 ( a int unsigned not null auto_increment primary key, b int unsigned Loading Loading @@ -32,4 +36,27 @@ sync_with_master; SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; connection master; drop table t1,t2; sync_slave_with_master; # # BUG#13236 multi-update with subquery & --replicate-ignore-table # reset master; connection master; CREATE TABLE t1 ( a INT ); INSERT INTO t1 VALUES (0); UPDATE t1, (SELECT 3 as b) AS x SET t1.a = x.b; select * from t1; sync_slave_with_master; connection slave; select * from t1; connection master; drop table t1; sync_slave_with_master; # End of 4.1 tests
sql/sql_update.cc +6 −2 Original line number Diff line number Diff line Loading @@ -569,7 +569,9 @@ int mysql_multi_update_lock(THD *thd, } DBUG_PRINT("info",("setting table `%s` for update", tl->alias)); tl->lock_type= thd->lex->multi_lock_option; tl->updating= 1; tl->updating= 1; // loacal or only list if (tl->table_list) tl->table_list->updating= 1; // global list (if we have 2 lists) wants= UPDATE_ACL; } else Loading @@ -579,7 +581,9 @@ int mysql_multi_update_lock(THD *thd, // correct order of statements. Otherwise, we use a TL_READ lock to // improve performance. tl->lock_type= using_update_log ? TL_READ_NO_INSERT : TL_READ; tl->updating= 0; tl->updating= 0; // loacal or only list if (tl->table_list) tl->table_list->updating= 0; // global list (if we have 2 lists) wants= SELECT_ACL; } Loading