Loading mysql-test/r/mix_innodb_myisam_binlog.result +24 −0 Original line number Diff line number Diff line Loading @@ -256,3 +256,27 @@ master-bin.000001 1648 Query 1 # use `test`; create table t2 (n int) engine=inno master-bin.000001 1748 Query 1 # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti` do release_lock("lock1"); drop table t0,t2; reset master; create table t1 (a int) engine=innodb; create table t2 (a int) engine=myisam; select get_lock("a",10); get_lock("a",10) 1 begin; insert into t1 values(8); insert into t2 select * from t1; select get_lock("a",10); get_lock("a",10) 1 select (@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output")) is not null; (@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output")) is not null 1 select @a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; @a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%" 1 1 drop table t1, t2; mysql-test/r/rpl_sp.result +13 −8 Original line number Diff line number Diff line Loading @@ -233,20 +233,25 @@ end @ # # delete from t2; alter table t2 add unique (a); drop function fn1; create function fn1() create function fn1(x int) returns int begin insert into t2 values(20),(20); insert into t2 values(x),(x); return 10; end| select fn1(); do fn1(100); Warnings: Error 1062 Duplicate entry '100' for key 1 select fn1(20); ERROR 23000: Duplicate entry '20' for key 1 select * from t2; a 20 100 select * from t2; a 20 100 create trigger trg before insert on t1 for each row set new.a= 10; ERROR 42000: Access denied; you need the SUPER privilege for this operation delete from t1; Loading Loading @@ -324,7 +329,7 @@ insert into t1 values (x); return x+2; end master-bin.000001 # Query 1 # use `mysqltest1`; delete t1,t2 from t1,t2 master-bin.000001 # Query 1 # use `mysqltest1`; DO `fn1`(20) master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(20) master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(fn1(21)) master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 master-bin.000001 # Query 1 # use `mysqltest1`; create function fn1() Loading @@ -351,13 +356,14 @@ end master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2 master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a) master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 master-bin.000001 # Query 1 # use `mysqltest1`; create function fn1() master-bin.000001 # Query 1 # use `mysqltest1`; create function fn1(x int) returns int begin insert into t2 values(20),(20); insert into t2 values(x),(x); return 10; end master-bin.000001 # Query 1 # use `mysqltest1`; DO `fn1`() master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(100) master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(20) master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10 master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) Loading Loading @@ -415,4 +421,3 @@ col test DROP PROCEDURE p1; drop table t1; reset master; mysql-test/r/sql_mode.result +16 −0 Original line number Diff line number Diff line Loading @@ -478,4 +478,20 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER="root"@"localhost" SQL SECURITY DEFINER VI create view v2 as select a from t2 where a in (select a from v1); drop view v2, v1; drop table t1, t2; select @@sql_mode; @@sql_mode ANSI_QUOTES set sql_mode=2097152; select @@sql_mode; @@sql_mode STRICT_TRANS_TABLES set sql_mode=16384+(65536*4); select @@sql_mode; @@sql_mode REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,NO_TABLE_OPTIONS,ANSI set sql_mode=2147483648; ERROR 42000: Variable 'sql_mode' can't be set to the value of '2147483648' select @@sql_mode; @@sql_mode REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,NO_TABLE_OPTIONS,ANSI SET @@SQL_MODE=@OLD_SQL_MODE; mysql-test/r/subselect.result +26 −0 Original line number Diff line number Diff line Loading @@ -3131,3 +3131,29 @@ a sum 3 20 4 40 DROP TABLE t1,t2,t3; CREATE TABLE t1 (a varchar(5), b varchar(10)); INSERT INTO t1 VALUES ('AAA', 5), ('BBB', 4), ('BBB', 1), ('CCC', 2), ('CCC', 7), ('AAA', 2), ('AAA', 4), ('BBB', 3), ('AAA', 8); SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); a b BBB 4 CCC 7 AAA 8 EXPLAIN SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary; Using filesort ALTER TABLE t1 ADD INDEX(a); SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); a b BBB 4 CCC 7 AAA 8 EXPLAIN SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where 2 DEPENDENT SUBQUERY t1 index NULL a 8 NULL 9 Using filesort DROP TABLE t1; mysql-test/t/mix_innodb_myisam_binlog.test +33 −1 Original line number Diff line number Diff line Loading @@ -259,5 +259,37 @@ show binlog events from 98; do release_lock("lock1"); drop table t0,t2; # End of 4.1 tests # Test for BUG#16559 (ROLLBACK should always have a zero error code in # binlog). Has to be here and not earlier, as the SELECTs influence # XIDs differently between normal and ps-protocol (and SHOW BINLOG # EVENTS above read XIDs). connect (con4,localhost,root,,); connection con3; reset master; create table t1 (a int) engine=innodb; create table t2 (a int) engine=myisam; select get_lock("a",10); begin; insert into t1 values(8); insert into t2 select * from t1; disconnect con3; connection con4; select get_lock("a",10); # wait for rollback to finish # we check that the error code of the "ROLLBACK" event is 0 and not # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction # and does not make slave to stop) --exec $MYSQL_BINLOG --start-position=547 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output")) is not null; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR eval select @a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; drop table t1, t2; Loading
mysql-test/r/mix_innodb_myisam_binlog.result +24 −0 Original line number Diff line number Diff line Loading @@ -256,3 +256,27 @@ master-bin.000001 1648 Query 1 # use `test`; create table t2 (n int) engine=inno master-bin.000001 1748 Query 1 # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti` do release_lock("lock1"); drop table t0,t2; reset master; create table t1 (a int) engine=innodb; create table t2 (a int) engine=myisam; select get_lock("a",10); get_lock("a",10) 1 begin; insert into t1 values(8); insert into t2 select * from t1; select get_lock("a",10); get_lock("a",10) 1 select (@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output")) is not null; (@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output")) is not null 1 select @a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; @a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%" 1 1 drop table t1, t2;
mysql-test/r/rpl_sp.result +13 −8 Original line number Diff line number Diff line Loading @@ -233,20 +233,25 @@ end @ # # delete from t2; alter table t2 add unique (a); drop function fn1; create function fn1() create function fn1(x int) returns int begin insert into t2 values(20),(20); insert into t2 values(x),(x); return 10; end| select fn1(); do fn1(100); Warnings: Error 1062 Duplicate entry '100' for key 1 select fn1(20); ERROR 23000: Duplicate entry '20' for key 1 select * from t2; a 20 100 select * from t2; a 20 100 create trigger trg before insert on t1 for each row set new.a= 10; ERROR 42000: Access denied; you need the SUPER privilege for this operation delete from t1; Loading Loading @@ -324,7 +329,7 @@ insert into t1 values (x); return x+2; end master-bin.000001 # Query 1 # use `mysqltest1`; delete t1,t2 from t1,t2 master-bin.000001 # Query 1 # use `mysqltest1`; DO `fn1`(20) master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(20) master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(fn1(21)) master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 master-bin.000001 # Query 1 # use `mysqltest1`; create function fn1() Loading @@ -351,13 +356,14 @@ end master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2 master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a) master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 master-bin.000001 # Query 1 # use `mysqltest1`; create function fn1() master-bin.000001 # Query 1 # use `mysqltest1`; create function fn1(x int) returns int begin insert into t2 values(20),(20); insert into t2 values(x),(x); return 10; end master-bin.000001 # Query 1 # use `mysqltest1`; DO `fn1`() master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(100) master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(20) master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10 master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) Loading Loading @@ -415,4 +421,3 @@ col test DROP PROCEDURE p1; drop table t1; reset master;
mysql-test/r/sql_mode.result +16 −0 Original line number Diff line number Diff line Loading @@ -478,4 +478,20 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER="root"@"localhost" SQL SECURITY DEFINER VI create view v2 as select a from t2 where a in (select a from v1); drop view v2, v1; drop table t1, t2; select @@sql_mode; @@sql_mode ANSI_QUOTES set sql_mode=2097152; select @@sql_mode; @@sql_mode STRICT_TRANS_TABLES set sql_mode=16384+(65536*4); select @@sql_mode; @@sql_mode REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,NO_TABLE_OPTIONS,ANSI set sql_mode=2147483648; ERROR 42000: Variable 'sql_mode' can't be set to the value of '2147483648' select @@sql_mode; @@sql_mode REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,NO_TABLE_OPTIONS,ANSI SET @@SQL_MODE=@OLD_SQL_MODE;
mysql-test/r/subselect.result +26 −0 Original line number Diff line number Diff line Loading @@ -3131,3 +3131,29 @@ a sum 3 20 4 40 DROP TABLE t1,t2,t3; CREATE TABLE t1 (a varchar(5), b varchar(10)); INSERT INTO t1 VALUES ('AAA', 5), ('BBB', 4), ('BBB', 1), ('CCC', 2), ('CCC', 7), ('AAA', 2), ('AAA', 4), ('BBB', 3), ('AAA', 8); SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); a b BBB 4 CCC 7 AAA 8 EXPLAIN SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary; Using filesort ALTER TABLE t1 ADD INDEX(a); SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); a b BBB 4 CCC 7 AAA 8 EXPLAIN SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where 2 DEPENDENT SUBQUERY t1 index NULL a 8 NULL 9 Using filesort DROP TABLE t1;
mysql-test/t/mix_innodb_myisam_binlog.test +33 −1 Original line number Diff line number Diff line Loading @@ -259,5 +259,37 @@ show binlog events from 98; do release_lock("lock1"); drop table t0,t2; # End of 4.1 tests # Test for BUG#16559 (ROLLBACK should always have a zero error code in # binlog). Has to be here and not earlier, as the SELECTs influence # XIDs differently between normal and ps-protocol (and SHOW BINLOG # EVENTS above read XIDs). connect (con4,localhost,root,,); connection con3; reset master; create table t1 (a int) engine=innodb; create table t2 (a int) engine=myisam; select get_lock("a",10); begin; insert into t1 values(8); insert into t2 select * from t1; disconnect con3; connection con4; select get_lock("a",10); # wait for rollback to finish # we check that the error code of the "ROLLBACK" event is 0 and not # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction # and does not make slave to stop) --exec $MYSQL_BINLOG --start-position=547 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output")) is not null; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR eval select @a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%", @a not like "%#%error_code=%error_code=%"; drop table t1, t2;