diff options
author | Sergei Golubchik <sergii@pisem.net> | 2011-07-02 22:08:51 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2011-07-02 22:08:51 +0200 |
commit | 9809f05199aeb0b67991fac41bd86f38730768dc (patch) | |
tree | fa2792ff86d0da014b535d743759810612338042 /mysql-test/suite/binlog | |
parent | 0accbd0364e0333e0b119aa9ce93e34ded9df6cb (diff) | |
parent | 5a0e7394a5ae0c7b6a1ea35b7ea3a8985325987a (diff) | |
download | mariadb-git-9809f05199aeb0b67991fac41bd86f38730768dc.tar.gz |
5.5-merge
Diffstat (limited to 'mysql-test/suite/binlog')
51 files changed, 1263 insertions, 147 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result index 7fb5e50a219..9a9f328f2b5 100644 --- a/mysql-test/suite/binlog/r/binlog_base64_flag.result +++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result @@ -91,6 +91,9 @@ iONkSBcBAAAAKwAAAMQBAAAQABAAAAAAAAEAA//4AQAAAAMAMTIzAQAAAA== '; ERROR HY000: master may suffer from http://bugs.mysql.com/bug.php?id=37426 so slave stops; check error log on slave for more info drop table t1, char63_utf8, char128_utf8; +call mtr.add_suppression("Slave SQL.*master suffers from this bug: http:..bugs.mysql.com.bug.php.id=37426.* Error_code: 1105"); +call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 1 size mismatch.* Error_code: 1535"); +call mtr.add_suppression("Slave SQL.*Column 1 of table .test.char128_utf8. cannot be converted.* Error_code: 1677"); # # Bug #54393: crash and/or valgrind errors in # mysql_client_binlog_statement diff --git a/mysql-test/suite/binlog/r/binlog_bug23533.result b/mysql-test/suite/binlog/r/binlog_bug23533.result new file mode 100644 index 00000000000..d5cd93284a2 --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_bug23533.result @@ -0,0 +1,15 @@ +SET AUTOCOMMIT=0; +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b TEXT, PRIMARY KEY(a)) ENGINE=InnoDB; +SELECT COUNT(*) FROM t1; +COUNT(*) +1000 +SET GLOBAL binlog_cache_size=4096; +SET GLOBAL max_binlog_cache_size=4096; +START TRANSACTION; +CREATE TABLE t2 SELECT * FROM t1; +ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mysqld variable and try again +COMMIT; +SHOW TABLES LIKE 't%'; +Tables_in_test (t%) +t1 +DROP TABLE t1; diff --git a/mysql-test/suite/binlog/r/binlog_bug36391.result b/mysql-test/suite/binlog/r/binlog_bug36391.result new file mode 100644 index 00000000000..551bfb9924d --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_bug36391.result @@ -0,0 +1,10 @@ +CREATE TABLE t1(id INT); +SHOW TABLES; +Tables_in_test +t1 +FLUSH LOGS; +DROP TABLE t1; +SHOW TABLES; +Tables_in_test +t1 +DROP TABLE t1; diff --git a/mysql-test/suite/binlog/r/binlog_database.result b/mysql-test/suite/binlog/r/binlog_database.result index b6299f9a940..0eaed3c97d7 100644 --- a/mysql-test/suite/binlog/r/binlog_database.result +++ b/mysql-test/suite/binlog/r/binlog_database.result @@ -39,6 +39,28 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt1` /* generated by server */ master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ FLUSH STATUS; +# +# Bug#11765416 58381: FAILED DROP DATABASE CAN BREAK STATEMENT +# BASED REPLICATION +# +DROP DATABASE IF EXISTS db1; +DROP TABLE IF EXISTS t3; +CREATE DATABASE db1; +CREATE TABLE db1.t1 (a INT); +CREATE TABLE db1.t2 (b INT, KEY(b)) engine=innodb; +CREATE TABLE t3 (a INT, KEY (a), FOREIGN KEY(a) REFERENCES db1.t2(b)) +engine=innodb; +RESET MASTER; +DROP DATABASE db1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails +SHOW TABLES FROM db1; +Tables_in_db1 +t2 +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `db1`; drop table `t1` +DROP TABLE t3; +DROP DATABASE db1; set binlog_format=mixed; reset master; create database testing_1; @@ -80,6 +102,28 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `tt1` /* generated by server */ master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ FLUSH STATUS; +# +# Bug#11765416 58381: FAILED DROP DATABASE CAN BREAK STATEMENT +# BASED REPLICATION +# +DROP DATABASE IF EXISTS db1; +DROP TABLE IF EXISTS t3; +CREATE DATABASE db1; +CREATE TABLE db1.t1 (a INT); +CREATE TABLE db1.t2 (b INT, KEY(b)) engine=innodb; +CREATE TABLE t3 (a INT, KEY (a), FOREIGN KEY(a) REFERENCES db1.t2(b)) +engine=innodb; +RESET MASTER; +DROP DATABASE db1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails +SHOW TABLES FROM db1; +Tables_in_db1 +t2 +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `db1`; drop table `t1` +DROP TABLE t3; +DROP DATABASE db1; set binlog_format=row; reset master; create database testing_1; @@ -122,6 +166,28 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `tt1` /* generated by server */ master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ FLUSH STATUS; +# +# Bug#11765416 58381: FAILED DROP DATABASE CAN BREAK STATEMENT +# BASED REPLICATION +# +DROP DATABASE IF EXISTS db1; +DROP TABLE IF EXISTS t3; +CREATE DATABASE db1; +CREATE TABLE db1.t1 (a INT); +CREATE TABLE db1.t2 (b INT, KEY(b)) engine=innodb; +CREATE TABLE t3 (a INT, KEY (a), FOREIGN KEY(a) REFERENCES db1.t2(b)) +engine=innodb; +RESET MASTER; +DROP DATABASE db1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails +SHOW TABLES FROM db1; +Tables_in_db1 +t2 +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `db1`; drop table `t1` +DROP TABLE t3; +DROP DATABASE db1; show databases; Database information_schema diff --git a/mysql-test/suite/binlog/r/binlog_drop_if_exists.result b/mysql-test/suite/binlog/r/binlog_drop_if_exists.result new file mode 100644 index 00000000000..0c398bed440 --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_drop_if_exists.result @@ -0,0 +1,98 @@ +RESET MASTER; +DROP PROCEDURE IF EXISTS db_bug_13684.p; +DROP FUNCTION IF EXISTS db_bug_13684.f; +DROP TRIGGER IF EXISTS db_bug_13684.tr; +DROP VIEW IF EXISTS db_bug_13684.v; +DROP EVENT IF EXISTS db_bug_13684.e; +DROP TABLE IF EXISTS db_bug_13684.t; +DROP DATABASE IF EXISTS db_bug_13684; +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS db_bug_13684.p +master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f +master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr +master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v +master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `db_bug_13684`.`t` /* generated by server */ +master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684 +CREATE DATABASE db_bug_13684; +CREATE TABLE db_bug_13684.t (a int); +CREATE EVENT db_bug_13684.e +ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR +DO +UPDATE db_bug_13684.t SET a = a + 1; +CREATE VIEW db_bug_13684.v +AS SELECT * FROM db_bug_13684.t; +CREATE TRIGGER db_bug_13684.tr BEFORE INSERT ON db_bug_13684.t +FOR EACH ROW BEGIN +END; +CREATE PROCEDURE db_bug_13684.p (OUT p1 INT) +BEGIN +END; +CREATE FUNCTION db_bug_13684.f (s CHAR(20)) +RETURNS CHAR(50) DETERMINISTIC +RETURN s; +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS db_bug_13684.p +master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f +master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr +master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v +master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `db_bug_13684`.`t` /* generated by server */ +master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684 +master-bin.000001 # Query # # CREATE DATABASE db_bug_13684 +master-bin.000001 # Query # # use `test`; CREATE TABLE db_bug_13684.t (a int) +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` EVENT db_bug_13684.e +ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR +DO +UPDATE db_bug_13684.t SET a = a + 1 +master-bin.000001 # Query # # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db_bug_13684`.`v` AS SELECT * FROM db_bug_13684.t +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER db_bug_13684.tr BEFORE INSERT ON db_bug_13684.t +FOR EACH ROW BEGIN +END +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `db_bug_13684`.`p`(OUT p1 INT) +BEGIN +END +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `db_bug_13684`.`f`(s CHAR(20)) RETURNS char(50) CHARSET latin1 + DETERMINISTIC +RETURN s +DROP PROCEDURE IF EXISTS db_bug_13684.p; +DROP FUNCTION IF EXISTS db_bug_13684.f; +DROP TRIGGER IF EXISTS db_bug_13684.tr; +DROP VIEW IF EXISTS db_bug_13684.v; +DROP EVENT IF EXISTS db_bug_13684.e; +DROP TABLE IF EXISTS db_bug_13684.t; +DROP DATABASE IF EXISTS db_bug_13684; +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS db_bug_13684.p +master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f +master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr +master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v +master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `db_bug_13684`.`t` /* generated by server */ +master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684 +master-bin.000001 # Query # # CREATE DATABASE db_bug_13684 +master-bin.000001 # Query # # use `test`; CREATE TABLE db_bug_13684.t (a int) +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` EVENT db_bug_13684.e +ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR +DO +UPDATE db_bug_13684.t SET a = a + 1 +master-bin.000001 # Query # # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `db_bug_13684`.`v` AS SELECT * FROM db_bug_13684.t +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER db_bug_13684.tr BEFORE INSERT ON db_bug_13684.t +FOR EACH ROW BEGIN +END +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `db_bug_13684`.`p`(OUT p1 INT) +BEGIN +END +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `db_bug_13684`.`f`(s CHAR(20)) RETURNS char(50) CHARSET latin1 + DETERMINISTIC +RETURN s +master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS db_bug_13684.p +master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS db_bug_13684.f +master-bin.000001 # Query # # use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr +master-bin.000001 # Query # # use `test`; DROP VIEW IF EXISTS db_bug_13684.v +master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS db_bug_13684.e +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `db_bug_13684`.`t` /* generated by server */ +master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_bug_13684 diff --git a/mysql-test/suite/binlog/r/binlog_index.result b/mysql-test/suite/binlog/r/binlog_index.result index e2688a15899..21a290bfc3b 100644 --- a/mysql-test/suite/binlog/r/binlog_index.result +++ b/mysql-test/suite/binlog/r/binlog_index.result @@ -2,8 +2,10 @@ call mtr.add_suppression('Attempting backtrace'); call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to process registered files that would be purged.'); call mtr.add_suppression('MSYQL_BIN_LOG::open failed to sync the index file'); call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.'); +call mtr.add_suppression('Could not open .*'); call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to clean registers before purging logs.'); flush tables; +RESET MASTER; flush logs; flush logs; flush logs; @@ -118,11 +120,31 @@ master-bin.000011 # This should put the server in unsafe state and stop # accepting any command. If we inject a fault at this # point and continue the execution the server crashes. -# Besides the flush command does not report an error. # +SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); +SELECT @index; +@index +master-bin.000006 +master-bin.000007 +master-bin.000008 +master-bin.000009 +master-bin.000010 +master-bin.000011 + # fault_injection_registering_index SET SESSION debug="+d,fault_injection_registering_index"; flush logs; +ERROR HY000: Can't open file: 'master-bin.000012' (errno: 1) +SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); +SELECT @index; +@index +master-bin.000006 +master-bin.000007 +master-bin.000008 +master-bin.000009 +master-bin.000010 +master-bin.000011 + SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); SELECT @index; @index @@ -137,6 +159,18 @@ master-bin.000012 # fault_injection_updating_index SET SESSION debug="+d,fault_injection_updating_index"; flush logs; +ERROR HY000: Can't open file: 'master-bin.000013' (errno: 1) +SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); +SELECT @index; +@index +master-bin.000006 +master-bin.000007 +master-bin.000008 +master-bin.000009 +master-bin.000010 +master-bin.000011 +master-bin.000012 + SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index'); SELECT @index; @index diff --git a/mysql-test/suite/binlog/r/binlog_innodb.result b/mysql-test/suite/binlog/r/binlog_innodb.result index dc170361026..cdb72aad902 100644 --- a/mysql-test/suite/binlog/r/binlog_innodb.result +++ b/mysql-test/suite/binlog/r/binlog_innodb.result @@ -123,7 +123,7 @@ Binlog_cache_disk_use 0 create table t1 (a int) engine=innodb; show status like "binlog_cache_use"; Variable_name Value -Binlog_cache_use 2 +Binlog_cache_use 1 show status like "binlog_cache_disk_use"; Variable_name Value Binlog_cache_disk_use 1 @@ -132,7 +132,7 @@ delete from t1; commit; show status like "binlog_cache_use"; Variable_name Value -Binlog_cache_use 4 +Binlog_cache_use 2 show status like "binlog_cache_disk_use"; Variable_name Value Binlog_cache_disk_use 1 diff --git a/mysql-test/suite/binlog/r/binlog_innodb_row.result b/mysql-test/suite/binlog/r/binlog_innodb_row.result index 093628c29cc..61f961f16da 100644 --- a/mysql-test/suite/binlog/r/binlog_innodb_row.result +++ b/mysql-test/suite/binlog/r/binlog_innodb_row.result @@ -59,3 +59,20 @@ show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t1` /* generated by server */ ############################################### +# +# Bug#12346411 SQL/LOG.CC:6509: ASSERTION `PREPARED_XIDS > 0' FAILED +# +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1(a INT PRIMARY KEY) engine=innodb; +CREATE TABLE t2(a INT) engine=myisam; +INSERT INTO t1 VALUES (1); +START TRANSACTION; +INSERT INTO t2 VALUES (1); +INSERT IGNORE INTO t1 VALUES (1); +COMMIT; +INSERT INTO t1 VALUES (2); +START TRANSACTION; +INSERT INTO t2 VALUES (2); +UPDATE IGNORE t1 SET a=1 WHERE a=2; +COMMIT; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/binlog/r/binlog_max_extension.result b/mysql-test/suite/binlog/r/binlog_max_extension.result index af341db4536..f69ffcce16a 100644 --- a/mysql-test/suite/binlog/r/binlog_max_extension.result +++ b/mysql-test/suite/binlog/r/binlog_max_extension.result @@ -3,6 +3,5 @@ call mtr.add_suppression("Log filename extension number exhausted:"); call mtr.add_suppression("Can't generate a unique log-filename"); RESET MASTER; FLUSH LOGS; -Warnings: -Warning 1098 Can't generate a unique log-filename master-bin.(1-999) +ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) diff --git a/mysql-test/suite/binlog/r/binlog_mix_innodb_stat.result b/mysql-test/suite/binlog/r/binlog_mix_innodb_stat.result deleted file mode 100644 index 637be940383..00000000000 --- a/mysql-test/suite/binlog/r/binlog_mix_innodb_stat.result +++ /dev/null @@ -1,25 +0,0 @@ -flush status; -show status like "binlog_cache_use"; -Variable_name Value -Binlog_cache_use 0 -show status like "binlog_cache_disk_use"; -Variable_name Value -Binlog_cache_disk_use 0 -drop table if exists t1; -create table t1 (a int) engine=innodb; -show status like "binlog_cache_use"; -Variable_name Value -Binlog_cache_use 2 -show status like "binlog_cache_disk_use"; -Variable_name Value -Binlog_cache_disk_use 1 -begin; -delete from t1; -commit; -show status like "binlog_cache_use"; -Variable_name Value -Binlog_cache_use 4 -show status like "binlog_cache_disk_use"; -Variable_name Value -Binlog_cache_disk_use 1 -drop table t1; diff --git a/mysql-test/suite/binlog/r/binlog_mixed_cache_stat.result b/mysql-test/suite/binlog/r/binlog_mixed_cache_stat.result new file mode 100644 index 00000000000..09cdab8414a --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_mixed_cache_stat.result @@ -0,0 +1,66 @@ +drop table if exists t1, t2; +create table t1 (a int) engine=innodb; +create table t2 (a int) engine=myisam; +**** Preparing the enviroment to check commit and its effect on status variables. +**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +flush status; +**** Transactional changes which are long enough so they will be flushed to disk... +**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +**** Transactional changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +begin; +insert into t1 values( 1 ); +commit; +**** Non-Transactional changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use = 0. +begin; +insert into t2 values( 1 ); +commit; +**** Mixed changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use = 0. +begin; +insert into t1 values( 1 ); +insert into t2 values( 1 ); +commit; +**** Preparing the enviroment to check abort and its effect on the status variables. +**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +flush status; +**** Transactional changes which are long enough so they will be flushed to disk... +**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +**** Transactional changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +begin; +insert into t1 values( 1 ); +rollback; +**** Non-Transactional changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use = 0. +begin; +insert into t2 values( 1 ); +rollback; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +**** Mixed changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use = 0. +begin; +insert into t1 values( 1 ); +insert into t2 values( 1 ); +rollback; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +drop table t1, t2; diff --git a/mysql-test/suite/binlog/r/binlog_old_versions.result b/mysql-test/suite/binlog/r/binlog_old_versions.result index 77289252b4c..a4850b835c8 100644 --- a/mysql-test/suite/binlog/r/binlog_old_versions.result +++ b/mysql-test/suite/binlog/r/binlog_old_versions.result @@ -1,4 +1,3 @@ -DROP TABLE IF EXISTS t1, t2, t3; ==== Read modern binlog (version 5.1.23) ==== SELECT * FROM t1 ORDER BY a; a b diff --git a/mysql-test/suite/binlog/r/binlog_query_filter_rules.result b/mysql-test/suite/binlog/r/binlog_query_filter_rules.result new file mode 100644 index 00000000000..520d500ed7c --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_query_filter_rules.result @@ -0,0 +1,11 @@ +drop table if exists t1; +reset master; +create table t1 (a int); +insert into t1 values (1); +flush logs; +drop table t1; +*** must be 1 *** +select * from t1; +a +1 +drop table t1; diff --git a/mysql-test/suite/binlog/r/binlog_reset_master.result b/mysql-test/suite/binlog/r/binlog_reset_master.result new file mode 100644 index 00000000000..b3d605560ff --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_reset_master.result @@ -0,0 +1 @@ +RESET MASTER; diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result index e45f4a76643..323d50d8f32 100644 --- a/mysql-test/suite/binlog/r/binlog_row_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result @@ -1218,8 +1218,8 @@ master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT drop table t1,t2,t3,tt1; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; -insert delayed into t1 values (207); -insert delayed into t1 values (null); +insert /* before delayed */ delayed /* after delayed */ into t1 values (207); +insert /*! delayed */ into t1 values (null); insert delayed into t1 values (300); FLUSH TABLES; show binlog events from <binlog_start>; @@ -1330,3 +1330,63 @@ Log_name Pos Event_type Server_id End_log_pos Info # # Write_rows 1 # table_id: # flags: STMT_END_F # # Query 1 # COMMIT DROP TABLE t1; + +# BUG#54903 BINLOG statement toggles session variables +# ---------------------------------------------------------------------- +# This test verify that BINLOG statement doesn't change current session's +# variables foreign_key_checks and unique_checks. + +CREATE TABLE t1 (c1 INT KEY); +SET @@SESSION.foreign_key_checks= ON; +SET @@SESSION.unique_checks= ON; +# INSERT INTO t1 VALUES (1) +# foreign_key_checks=0 and unique_checks=0 +BINLOG ' +dfLtTBMBAAAAKQAAANcAAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= +dfLtTBcBAAAAIgAAAPkAAAAAABcAAAAAAAcAAf/+AQAAAA== +'; +SELECT * FROM t1; +c1 +1 +# Their values should be ON +SHOW SESSION VARIABLES LIKE "%_checks"; +Variable_name Value +foreign_key_checks ON +unique_checks ON + +SET @@SESSION.foreign_key_checks= OFF; +SET @@SESSION.unique_checks= OFF; +# INSERT INTO t1 VALUES(2) +# foreign_key_checks=1 and unique_checks=1 +BINLOG ' +dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= +dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA== +'; +SELECT * FROM t1; +c1 +1 +2 +# Their values should be OFF +SHOW SESSION VARIABLES LIKE "%_checks"; +Variable_name Value +foreign_key_checks OFF +unique_checks OFF +# INSERT INTO t1 VALUES(2) +# foreign_key_checks=1 and unique_checks=1 +# It should not change current session's variables, even error happens +call mtr.add_suppression("Slave SQL.*Could not execute Write_rows event on table test.t1; Duplicate entry .2. for key .PRIMARY., Error_code: 1062"); +BINLOG ' +dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= +dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA== +'; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +SELECT * FROM t1; +c1 +1 +2 +# Their values should be OFF +SHOW SESSION VARIABLES LIKE "%_checks"; +Variable_name Value +foreign_key_checks OFF +unique_checks OFF +DROP TABLE t1; diff --git a/mysql-test/suite/binlog/r/binlog_row_cache_stat.result b/mysql-test/suite/binlog/r/binlog_row_cache_stat.result new file mode 100644 index 00000000000..09cdab8414a --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_row_cache_stat.result @@ -0,0 +1,66 @@ +drop table if exists t1, t2; +create table t1 (a int) engine=innodb; +create table t2 (a int) engine=myisam; +**** Preparing the enviroment to check commit and its effect on status variables. +**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +flush status; +**** Transactional changes which are long enough so they will be flushed to disk... +**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +**** Transactional changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +begin; +insert into t1 values( 1 ); +commit; +**** Non-Transactional changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use = 0. +begin; +insert into t2 values( 1 ); +commit; +**** Mixed changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use = 0. +begin; +insert into t1 values( 1 ); +insert into t2 values( 1 ); +commit; +**** Preparing the enviroment to check abort and its effect on the status variables. +**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +flush status; +**** Transactional changes which are long enough so they will be flushed to disk... +**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +**** Transactional changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +begin; +insert into t1 values( 1 ); +rollback; +**** Non-Transactional changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use = 0. +begin; +insert into t2 values( 1 ); +rollback; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +**** Mixed changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use = 0. +begin; +insert into t1 values( 1 ); +insert into t2 values( 1 ); +rollback; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +drop table t1, t2; diff --git a/mysql-test/suite/binlog/r/binlog_row_innodb_stat.result b/mysql-test/suite/binlog/r/binlog_row_innodb_stat.result deleted file mode 100644 index 637be940383..00000000000 --- a/mysql-test/suite/binlog/r/binlog_row_innodb_stat.result +++ /dev/null @@ -1,25 +0,0 @@ -flush status; -show status like "binlog_cache_use"; -Variable_name Value -Binlog_cache_use 0 -show status like "binlog_cache_disk_use"; -Variable_name Value -Binlog_cache_disk_use 0 -drop table if exists t1; -create table t1 (a int) engine=innodb; -show status like "binlog_cache_use"; -Variable_name Value -Binlog_cache_use 2 -show status like "binlog_cache_disk_use"; -Variable_name Value -Binlog_cache_disk_use 1 -begin; -delete from t1; -commit; -show status like "binlog_cache_use"; -Variable_name Value -Binlog_cache_use 4 -show status like "binlog_cache_disk_use"; -Variable_name Value -Binlog_cache_disk_use 1 -drop table t1; diff --git a/mysql-test/suite/binlog/r/binlog_server_id.result b/mysql-test/suite/binlog/r/binlog_server_id.result new file mode 100644 index 00000000000..f7d778a288b --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_server_id.result @@ -0,0 +1,34 @@ +set global server_id=1; +reset master; +drop table if exists t1,t2,t3; +create table t1 (a int); +select @@server_id; +@@server_id +1 +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */ +master-bin.000001 # Query 1 # use `test`; create table t1 (a int) +set global server_id=2; +create table t2 (b int); +select @@server_id; +@@server_id +2 +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */ +master-bin.000001 # Query 1 # use `test`; create table t1 (a int) +master-bin.000001 # Query 2 # use `test`; create table t2 (b int) +set global server_id=3; +create table t3 (c int); +select @@server_id; +@@server_id +3 +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */ +master-bin.000001 # Query 1 # use `test`; create table t1 (a int) +master-bin.000001 # Query 2 # use `test`; create table t2 (b int) +master-bin.000001 # Query 3 # use `test`; create table t3 (c int) +set global server_id=1; +drop table t1,t2,t3; diff --git a/mysql-test/suite/binlog/r/binlog_sf.result b/mysql-test/suite/binlog/r/binlog_sf.result new file mode 100644 index 00000000000..085ba1ebb8a --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_sf.result @@ -0,0 +1,68 @@ +set global log_bin_trust_function_creators=0; +set binlog_format=STATEMENT; +create function fn16456() +returns int +begin +return unix_timestamp(); +end| +ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) +set global log_bin_trust_function_creators=1; +create function fn16456() +returns int +begin +return unix_timestamp(); +end| +set global log_bin_trust_function_creators=0; +set binlog_format=ROW; +select fn16456(); +fn16456() +timestamp +set binlog_format=STATEMENT; +select fn16456(); +ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) +drop function fn16456; +set global log_bin_trust_function_creators=0; +create function fn16456() +returns int deterministic +begin +return unix_timestamp(); +end| +set binlog_format=ROW; +select fn16456(); +fn16456() +timestamp +set binlog_format=STATEMENT; +select fn16456(); +fn16456() +timestamp +drop function fn16456; +set global log_bin_trust_function_creators=0; +create function fn16456() +returns int no sql +begin +return unix_timestamp(); +end| +set binlog_format=ROW; +select fn16456(); +fn16456() +timestamp +set binlog_format=STATEMENT; +select fn16456(); +fn16456() +timestamp +drop function fn16456; +set global log_bin_trust_function_creators=0; +create function fn16456() +returns int reads sql data +begin +return unix_timestamp(); +end| +set binlog_format=ROW; +select fn16456(); +fn16456() +timestamp +set binlog_format=STATEMENT; +select fn16456(); +fn16456() +timestamp +drop function fn16456; diff --git a/mysql-test/suite/binlog/r/binlog_sql_mode.result b/mysql-test/suite/binlog/r/binlog_sql_mode.result index e306040502d..4477c94a95e 100644 --- a/mysql-test/suite/binlog/r/binlog_sql_mode.result +++ b/mysql-test/suite/binlog/r/binlog_sql_mode.result @@ -1,9 +1,3 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; SET @old_sql_mode= @@global.sql_mode; SET @old_binlog_format=@@session.binlog_format; SET SESSION sql_mode=8; @@ -27,7 +21,7 @@ DO BEGIN UPDATE t1 SET id = id +1; END;| -Chceck Result +Check Result select (@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog")) is not null; diff --git a/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result b/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result index 2219961aca0..cdcc96b94b0 100644 --- a/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result +++ b/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result @@ -1,6 +1,6 @@ create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; -insert delayed into t1 values (207); -insert delayed into t1 values (null); +insert /* before delayed */ delayed /* after delayed */ into t1 values (207); +insert /*! delayed */ into t1 values (null); insert delayed into t1 values (300); FLUSH TABLES; show binlog events from <binlog_start>; @@ -10,14 +10,14 @@ master-bin.000001 # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; insert delayed into t1 values (207) +master-bin.000001 # Query # # use `test`; insert /* before delayed */ /* after delayed */ into t1 values (207) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Intvar # # INSERT_ID=208 -master-bin.000001 # Query # # use `test`; insert delayed into t1 values (null) +master-bin.000001 # Query # # use `test`; insert /*! */ into t1 values (null) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN -master-bin.000001 # Query # # use `test`; insert delayed into t1 values (300) +master-bin.000001 # Query # # use `test`; insert into t1 values (300) master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; FLUSH TABLES RESET MASTER; diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result index 55809d4bda1..1a05a930e2c 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result @@ -719,8 +719,8 @@ master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhos master-bin.000001 # Query # # COMMIT drop table t1,t2,t3,tt1; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; -insert delayed into t1 values (207); -insert delayed into t1 values (null); +insert /* before delayed */ delayed /* after delayed */ into t1 values (207); +insert /*! delayed */ into t1 values (null); insert delayed into t1 values (300); FLUSH TABLES; show binlog events from <binlog_start>; @@ -822,3 +822,63 @@ Log_name Pos Event_type Server_id End_log_pos Info # # Write_rows 1 # table_id: # flags: STMT_END_F # # Query 1 # COMMIT DROP TABLE t1; + +# BUG#54903 BINLOG statement toggles session variables +# ---------------------------------------------------------------------- +# This test verify that BINLOG statement doesn't change current session's +# variables foreign_key_checks and unique_checks. + +CREATE TABLE t1 (c1 INT KEY); +SET @@SESSION.foreign_key_checks= ON; +SET @@SESSION.unique_checks= ON; +# INSERT INTO t1 VALUES (1) +# foreign_key_checks=0 and unique_checks=0 +BINLOG ' +dfLtTBMBAAAAKQAAANcAAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= +dfLtTBcBAAAAIgAAAPkAAAAAABcAAAAAAAcAAf/+AQAAAA== +'; +SELECT * FROM t1; +c1 +1 +# Their values should be ON +SHOW SESSION VARIABLES LIKE "%_checks"; +Variable_name Value +foreign_key_checks ON +unique_checks ON + +SET @@SESSION.foreign_key_checks= OFF; +SET @@SESSION.unique_checks= OFF; +# INSERT INTO t1 VALUES(2) +# foreign_key_checks=1 and unique_checks=1 +BINLOG ' +dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= +dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA== +'; +SELECT * FROM t1; +c1 +1 +2 +# Their values should be OFF +SHOW SESSION VARIABLES LIKE "%_checks"; +Variable_name Value +foreign_key_checks OFF +unique_checks OFF +# INSERT INTO t1 VALUES(2) +# foreign_key_checks=1 and unique_checks=1 +# It should not change current session's variables, even error happens +call mtr.add_suppression("Slave SQL.*Could not execute Write_rows event on table test.t1; Duplicate entry .2. for key .PRIMARY., Error_code: 1062"); +BINLOG ' +dfLtTBMBAAAAKQAAAKsBAAAAABcAAAAAAAEABHRlc3QAAnQxAAEDAAE= +dfLtTBcBAAAAIgAAAM0BAAAAABcAAAAAAAEAAf/+AgAAAA== +'; +ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +SELECT * FROM t1; +c1 +1 +2 +# Their values should be OFF +SHOW SESSION VARIABLES LIKE "%_checks"; +Variable_name Value +foreign_key_checks OFF +unique_checks OFF +DROP TABLE t1; diff --git a/mysql-test/suite/binlog/r/binlog_stm_cache_stat.result b/mysql-test/suite/binlog/r/binlog_stm_cache_stat.result new file mode 100644 index 00000000000..09cdab8414a --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_stm_cache_stat.result @@ -0,0 +1,66 @@ +drop table if exists t1, t2; +create table t1 (a int) engine=innodb; +create table t2 (a int) engine=myisam; +**** Preparing the enviroment to check commit and its effect on status variables. +**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +flush status; +**** Transactional changes which are long enough so they will be flushed to disk... +**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +**** Transactional changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +begin; +insert into t1 values( 1 ); +commit; +**** Non-Transactional changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use = 0. +begin; +insert into t2 values( 1 ); +commit; +**** Mixed changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use = 0. +begin; +insert into t1 values( 1 ); +insert into t2 values( 1 ); +commit; +**** Preparing the enviroment to check abort and its effect on the status variables. +**** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +flush status; +**** Transactional changes which are long enough so they will be flushed to disk... +**** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +**** Transactional changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0. +begin; +insert into t1 values( 1 ); +rollback; +**** Non-Transactional changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use = 0. +begin; +insert into t2 values( 1 ); +rollback; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +**** Mixed changes which should not be flushed to disk and so should not +**** increase either binlog_cache_disk_use or binlog_stmt_cache_disk_use. +**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1. +**** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use = 0. +begin; +insert into t1 values( 1 ); +insert into t2 values( 1 ); +rollback; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +drop table t1, t2; diff --git a/mysql-test/suite/binlog/r/binlog_stm_innodb_stat.result b/mysql-test/suite/binlog/r/binlog_stm_innodb_stat.result deleted file mode 100644 index 637be940383..00000000000 --- a/mysql-test/suite/binlog/r/binlog_stm_innodb_stat.result +++ /dev/null @@ -1,25 +0,0 @@ -flush status; -show status like "binlog_cache_use"; -Variable_name Value -Binlog_cache_use 0 -show status like "binlog_cache_disk_use"; -Variable_name Value -Binlog_cache_disk_use 0 -drop table if exists t1; -create table t1 (a int) engine=innodb; -show status like "binlog_cache_use"; -Variable_name Value -Binlog_cache_use 2 -show status like "binlog_cache_disk_use"; -Variable_name Value -Binlog_cache_disk_use 1 -begin; -delete from t1; -commit; -show status like "binlog_cache_use"; -Variable_name Value -Binlog_cache_use 4 -show status like "binlog_cache_disk_use"; -Variable_name Value -Binlog_cache_disk_use 1 -drop table t1; diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result index 20d82557122..da2e24506fd 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result @@ -698,7 +698,7 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Intvar # # INSERT_ID=10 master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# master-bin.000001 # Intvar # # INSERT_ID=10 -master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @b) SET `b`=((@b) + `bug27417`(2)) ;file_id=# +master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @b) SET `b`= @b + bug27417(2) ;file_id=# master-bin.000001 # Query # # ROLLBACK /* the output must denote there is the query */; drop trigger trg_del_t2; @@ -950,7 +950,7 @@ master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# master-bin.000001 # Intvar # # INSERT_ID=10 master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci -master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @b) SET `b`=((@b) + `bug27417`(2)) ;file_id=# +master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @b) SET `b`= @b + bug27417(2) ;file_id=# master-bin.000001 # Query # # ROLLBACK drop trigger trg_del_t2; drop table t1,t2,t3,t4,t5; diff --git a/mysql-test/suite/binlog/r/binlog_unsafe.result b/mysql-test/suite/binlog/r/binlog_unsafe.result index 19d04169589..e8449f0cd11 100644 --- a/mysql-test/suite/binlog/r/binlog_unsafe.result +++ b/mysql-test/suite/binlog/r/binlog_unsafe.result @@ -2418,7 +2418,7 @@ INSERT INTO t1 SELECT * FROM t2 LIMIT 1; DROP TABLE t1,t2; "Should NOT have any warning message issued in the following func7() and trig" CREATE TABLE t1 (a INT); -CREATE TABLE t2 (a CHAR(40)); +CREATE TABLE t2 (a TEXT); CREATE TABLE trigger_table (a CHAR(7)); CREATE FUNCTION func7() RETURNS INT diff --git a/mysql-test/suite/binlog/t/binlog_base64_flag.test b/mysql-test/suite/binlog/t/binlog_base64_flag.test index 3f1e4e98bec..2ec979aade0 100644 --- a/mysql-test/suite/binlog/t/binlog_base64_flag.test +++ b/mysql-test/suite/binlog/t/binlog_base64_flag.test @@ -151,6 +151,9 @@ iONkSBcBAAAAKwAAAMQBAAAQABAAAAAAAAEAA//4AQAAAAMAMTIzAQAAAA== drop table t1, char63_utf8, char128_utf8; +call mtr.add_suppression("Slave SQL.*master suffers from this bug: http:..bugs.mysql.com.bug.php.id=37426.* Error_code: 1105"); +call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 1 size mismatch.* Error_code: 1535"); +call mtr.add_suppression("Slave SQL.*Column 1 of table .test.char128_utf8. cannot be converted.* Error_code: 1677"); --echo # --echo # Bug #54393: crash and/or valgrind errors in diff --git a/mysql-test/suite/binlog/t/binlog_bug23533.test b/mysql-test/suite/binlog/t/binlog_bug23533.test new file mode 100644 index 00000000000..ca610e399e4 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_bug23533.test @@ -0,0 +1,50 @@ +############################################################# +# Bug#23533: CREATE SELECT max_binlog_cache_size test +# case needed +############################################################# + +--source include/have_innodb.inc +--source include/have_log_bin.inc +--source include/have_binlog_format_row.inc + +SET AUTOCOMMIT=0; + +# Create 1st table +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b TEXT, PRIMARY KEY(a)) ENGINE=InnoDB; +--disable_query_log +let $i= 1000; +while ($i) +{ + BEGIN; + eval INSERT INTO t1 VALUES($i, REPEAT('x', 4096)); + COMMIT; + dec $i; +} +--enable_query_log +SELECT COUNT(*) FROM t1; + +# Set small value for max_binlog_cache_size +let $saved_binlog_cache_size= query_get_value(SELECT @@binlog_cache_size AS Value, Value, 1); +let $saved_max_binlog_cache_size= query_get_value(SELECT @@max_binlog_cache_size AS Value, Value, 1); +SET GLOBAL binlog_cache_size=4096; +SET GLOBAL max_binlog_cache_size=4096; + +# New value of max_binlog_cache_size will apply to new session +disconnect default; +connect(default,localhost,root,,test); + +# Copied data from t1 into t2 large than max_binlog_cache_size +START TRANSACTION; +--error ER_TRANS_CACHE_FULL +CREATE TABLE t2 SELECT * FROM t1; +COMMIT; +SHOW TABLES LIKE 't%'; + +# 5.1 End of Test +--disable_query_log +eval SET GLOBAL max_binlog_cache_size=$saved_max_binlog_cache_size; +eval SET GLOBAL binlog_cache_size=$saved_binlog_cache_size; +--enable_query_log +DROP TABLE t1; +disconnect default; +connect(default,localhost,root,,test); diff --git a/mysql-test/suite/binlog/t/binlog_bug36391-master.opt b/mysql-test/suite/binlog/t/binlog_bug36391-master.opt new file mode 100644 index 00000000000..56273241f14 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_bug36391-master.opt @@ -0,0 +1 @@ +--sql_mode=NO_BACKSLASH_ESCAPES diff --git a/mysql-test/suite/binlog/t/binlog_bug36391.test b/mysql-test/suite/binlog/t/binlog_bug36391.test new file mode 100644 index 00000000000..64d91dfafd9 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_bug36391.test @@ -0,0 +1,30 @@ +# +# BUG#36391 and BUG#38731 +# +# The fix for BUG#20103 "Escaping with backslash does not work as expected" +# was implemented too greedy though in that it not only changes the behavior +# of backslashes within strings but in general, so disabling command shortcuts +# like \G or \C (which in turn leads to BUG#36391: "mysqlbinlog creates invalid charset statements". +# +# The test executes simple commands that are stored in the binary log and +# re-execute them through the mysql client which should have to process +# some command shortcuts. The backslashes within strings is disabled in the file +# rpl_bug36391-master.opt by the option --sql_mode=NO_BACKSLASH_ESCAPES. +# +# + +--source include/have_log_bin.inc +--source include/have_binlog_format_mixed.inc + +CREATE TABLE t1(id INT); +let $binlog= query_get_value(SHOW MASTER STATUS, File, 1); +let $binlog_path= `SELECT CONCAT(@@DATADIR, '$binlog')`; +SHOW TABLES; +FLUSH LOGS; +DROP TABLE t1; + +--exec $MYSQL_BINLOG $binlog_path | $MYSQL test +SHOW TABLES; + +# Clean up +DROP TABLE t1; diff --git a/mysql-test/suite/binlog/t/binlog_drop_if_exists.test b/mysql-test/suite/binlog/t/binlog_drop_if_exists.test new file mode 100644 index 00000000000..6b2b37ae791 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_drop_if_exists.test @@ -0,0 +1,115 @@ +# BUG#13684: +# SP: DROP PROCEDURE|FUNCTION IF EXISTS not binlogged if routine +# does not exist +# +# There is an inconsistency with DROP DATABASE IF EXISTS, DROP +# TABLE IF EXISTS and DROP VIEW IF EXISTS: those are binlogged even +# if the DB or TABLE does not exist, whereas DROP PROCEDURE IF +# EXISTS does not. It would be nice or at least consistent if DROP +# PROCEDURE/STATEMENT worked the same too. +# +# Description: +# DROP PROCEDURE|FUNCTION IF EXISTS does not get binlogged whereas DROP +# DATABASE|TABLE|TRIGGER|... IF EXISTS do. +# +# Fixed DROP PROCEDURE|FUNCTION IF EXISTS by adding a call to +# write_bin_log in mysql_execute_command. Checked also if all +# documented "DROP (...) IF EXISTS" get binlogged. Left out DROP +# SERVER IF EXISTS because it seems that it only gets binlogged when +# using row event (see BUG#25705). +# +# TODO: add DROP SERVER IF EXISTS to the test case when its +# binlogging procedure gets fixed (BUG#25705). Furthermore, when +# logging in RBR format the events that get logged are effectively in +# RBR format and not in STATEMENT format meaning that one must needs +# to be extra careful when writing a test for it, or change the CREATE +# SERVER logging to always log as STATEMENT. You can quickly check this +# by enabling the flag below $fixed_bug_25705=1 and watch the diff on +# the STDOUT. More detail may be found on the generated reject file. +# +# Test is implemented as follows: +# +# i) test each "drop if exists" (DDL), found in MySQL 5.1 manual, +# on inexistent objects (except for DROP SERVER); +# ii) show binlog events; +# iii) create an object for each drop if exists statement; +# iv) issue "drop if exists" in existent objects. +# v) show binlog events; +# +# References: +# http://dev.mysql.com/doc/refman/5.1/en/sql-syntax-data-definition.html +# +--source include/have_log_bin.inc +RESET MASTER; + +disable_warnings; + +# test all "drop if exists" in manual with inexistent objects +DROP PROCEDURE IF EXISTS db_bug_13684.p; +DROP FUNCTION IF EXISTS db_bug_13684.f; +DROP TRIGGER IF EXISTS db_bug_13684.tr; +DROP VIEW IF EXISTS db_bug_13684.v; +DROP EVENT IF EXISTS db_bug_13684.e; +DROP TABLE IF EXISTS db_bug_13684.t; +DROP DATABASE IF EXISTS db_bug_13684; + +let $fixed_bug_25705 = 0; + +if($fixed_bug_25705) +{ + DROP SERVER IF EXISTS s_bug_13684; +} +--source include/show_binlog_events.inc + +# test drop with existing values + +# create +CREATE DATABASE db_bug_13684; + +CREATE TABLE db_bug_13684.t (a int); + +CREATE EVENT db_bug_13684.e + ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR + DO + UPDATE db_bug_13684.t SET a = a + 1; + +CREATE VIEW db_bug_13684.v + AS SELECT * FROM db_bug_13684.t; + +CREATE TRIGGER db_bug_13684.tr BEFORE INSERT ON db_bug_13684.t + FOR EACH ROW BEGIN + END; + +CREATE PROCEDURE db_bug_13684.p (OUT p1 INT) + BEGIN + END; + +CREATE FUNCTION db_bug_13684.f (s CHAR(20)) + RETURNS CHAR(50) DETERMINISTIC + RETURN s; + +if($fixed_bug_25705) +{ + CREATE SERVER s_bug_13684 + FOREIGN DATA WRAPPER mysql + OPTIONS (USER 'Remote', HOST '192.168.1.106', DATABASE 'test'); +} + +--source include/show_binlog_events.inc + +# drop existing +DROP PROCEDURE IF EXISTS db_bug_13684.p; +DROP FUNCTION IF EXISTS db_bug_13684.f; +DROP TRIGGER IF EXISTS db_bug_13684.tr; +DROP VIEW IF EXISTS db_bug_13684.v; +DROP EVENT IF EXISTS db_bug_13684.e; +DROP TABLE IF EXISTS db_bug_13684.t; +DROP DATABASE IF EXISTS db_bug_13684; +if($fixed_bug_25705) +{ + DROP SERVER IF EXISTS s_bug_13684; +} + +--source include/show_binlog_events.inc + +enable_warnings; diff --git a/mysql-test/suite/binlog/t/binlog_index-master.opt b/mysql-test/suite/binlog/t/binlog_index-master.opt new file mode 100644 index 00000000000..cef79bc8585 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_index-master.opt @@ -0,0 +1 @@ +--force-restart diff --git a/mysql-test/suite/binlog/t/binlog_index.test b/mysql-test/suite/binlog/t/binlog_index.test index 3847e40aeb2..86c314e9236 100644 --- a/mysql-test/suite/binlog/t/binlog_index.test +++ b/mysql-test/suite/binlog/t/binlog_index.test @@ -6,15 +6,20 @@ source include/not_embedded.inc; # Don't test this under valgrind, memory leaks will occur --source include/not_valgrind.inc source include/have_debug.inc; +# Avoid CrashReporter popup on Mac +--source include/not_crashrep.inc call mtr.add_suppression('Attempting backtrace'); call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to process registered files that would be purged.'); call mtr.add_suppression('MSYQL_BIN_LOG::open failed to sync the index file'); call mtr.add_suppression('Turning logging off for the whole duration of the MySQL server process.'); +call mtr.add_suppression('Could not open .*'); call mtr.add_suppression('MSYQL_BIN_LOG::purge_logs failed to clean registers before purging logs.'); flush tables; let $old=`select @@debug`; +RESET MASTER; + let $MYSQLD_DATADIR= `select @@datadir`; let $INDEX=$MYSQLD_DATADIR/master-bin.index; @@ -208,12 +213,26 @@ SELECT @index; --echo # This should put the server in unsafe state and stop --echo # accepting any command. If we inject a fault at this --echo # point and continue the execution the server crashes. ---echo # Besides the flush command does not report an error. --echo # +--chmod 0644 $INDEX +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SET @index=LOAD_FILE('$index') +-- replace_regex /\.[\\\/]master/master/ +SELECT @index; + --echo # fault_injection_registering_index SET SESSION debug="+d,fault_injection_registering_index"; +-- replace_regex /\.[\\\/]master/master/ +-- error ER_CANT_OPEN_FILE flush logs; + +--chmod 0644 $INDEX +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SET @index=LOAD_FILE('$index') +-- replace_regex /\.[\\\/]master/master/ +SELECT @index; + --source include/restart_mysqld.inc --chmod 0644 $INDEX @@ -224,7 +243,16 @@ SELECT @index; --echo # fault_injection_updating_index SET SESSION debug="+d,fault_injection_updating_index"; +-- replace_regex /\.[\\\/]master/master/ +-- error ER_CANT_OPEN_FILE flush logs; + +--chmod 0644 $INDEX +-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +-- eval SET @index=LOAD_FILE('$index') +-- replace_regex /\.[\\\/]master/master/ +SELECT @index; + --source include/restart_mysqld.inc --chmod 0644 $INDEX diff --git a/mysql-test/suite/binlog/t/binlog_innodb_row.test b/mysql-test/suite/binlog/t/binlog_innodb_row.test index b491510c9c9..f4ad1058a7e 100644 --- a/mysql-test/suite/binlog/t/binlog_innodb_row.test +++ b/mysql-test/suite/binlog/t/binlog_innodb_row.test @@ -77,3 +77,29 @@ DROP TEMPORARY TABLE t1; -- echo ############################################### -- source include/show_binlog_events.inc -- echo ############################################### + + +--echo # +--echo # Bug#12346411 SQL/LOG.CC:6509: ASSERTION `PREPARED_XIDS > 0' FAILED +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +CREATE TABLE t1(a INT PRIMARY KEY) engine=innodb; +CREATE TABLE t2(a INT) engine=myisam; + +INSERT INTO t1 VALUES (1); +START TRANSACTION; +INSERT INTO t2 VALUES (1); +INSERT IGNORE INTO t1 VALUES (1); +COMMIT; + +INSERT INTO t1 VALUES (2); +START TRANSACTION; +INSERT INTO t2 VALUES (2); +UPDATE IGNORE t1 SET a=1 WHERE a=2; +COMMIT; + +DROP TABLE t1, t2; diff --git a/mysql-test/suite/binlog/t/binlog_max_extension.test b/mysql-test/suite/binlog/t/binlog_max_extension.test index 9f52d195e21..e5274d87b85 100644 --- a/mysql-test/suite/binlog/t/binlog_max_extension.test +++ b/mysql-test/suite/binlog/t/binlog_max_extension.test @@ -38,9 +38,7 @@ RESET MASTER; ########## # 1. Stop master server --- write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait -EOF +-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -- shutdown_server 10 -- source include/wait_until_disconnected.inc @@ -52,9 +50,7 @@ master-bin.2147483646 EOF # 3. Restart the server --- append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart -EOF +-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -- enable_reconnect -- source include/wait_until_connected_again.inc @@ -62,7 +58,8 @@ EOF # Assertion ########### -# assertion: should throw warning +# assertion: should raise error +-- error ER_NO_UNIQUE_LOGFILE FLUSH LOGS; ############## @@ -70,9 +67,7 @@ FLUSH LOGS; ############## # 1. Stop the server --- write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait -EOF +-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -- shutdown_server 10 -- source include/wait_until_disconnected.inc @@ -85,8 +80,6 @@ EOF -- remove_file $MYSQLD_DATADIR/master-bin.2147483647 # 3. Restart the server --- append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart -EOF +-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -- enable_reconnect -- source include/wait_until_connected_again.inc diff --git a/mysql-test/suite/binlog/t/binlog_mix_innodb_stat.test b/mysql-test/suite/binlog/t/binlog_mixed_cache_stat.test index 0be097c78ed..3e63fb3bc9c 100644 --- a/mysql-test/suite/binlog/t/binlog_mix_innodb_stat.test +++ b/mysql-test/suite/binlog/t/binlog_mixed_cache_stat.test @@ -2,4 +2,4 @@ # For both statement and row based bin logs 9/19/2005 [jbm] -- source include/have_binlog_format_mixed.inc --- source extra/binlog_tests/innodb_stat.test +-- source extra/binlog_tests/binlog_cache_stat.test diff --git a/mysql-test/suite/binlog/t/binlog_old_versions.test b/mysql-test/suite/binlog/t/binlog_old_versions.test index 0ccea406a82..b294adbc69d 100644 --- a/mysql-test/suite/binlog/t/binlog_old_versions.test +++ b/mysql-test/suite/binlog/t/binlog_old_versions.test @@ -24,9 +24,6 @@ source include/not_embedded.inc; ---disable_warnings -DROP TABLE IF EXISTS t1, t2, t3; - --echo ==== Read modern binlog (version 5.1.23) ==== @@ -161,3 +158,4 @@ DROP TABLE t1, t2, t3; #SELECT * FROM t1 ORDER BY a; #SELECT * FROM t2 ORDER BY a; #SELECT COUNT(*) FROM t3; +#--source include/rpl_end.inc diff --git a/mysql-test/suite/binlog/t/binlog_query_filter_rules-master.opt b/mysql-test/suite/binlog/t/binlog_query_filter_rules-master.opt new file mode 100644 index 00000000000..33632bf98e8 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_query_filter_rules-master.opt @@ -0,0 +1 @@ +--replicate-do-db='impossible_database' diff --git a/mysql-test/suite/binlog/t/binlog_query_filter_rules.test b/mysql-test/suite/binlog/t/binlog_query_filter_rules.test new file mode 100644 index 00000000000..d56a32ce2bd --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_query_filter_rules.test @@ -0,0 +1,32 @@ +# regression test for +# Bug#36099 replicate-do-db affects replaying RBR events with mysqlbinlog +# The test verifies that the slave side filtering rule does not affect +# applying of row-events on master via mysqlbinlog + +-- source include/have_log_bin.inc +-- source include/not_embedded.inc +-- source include/have_binlog_format_row.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +reset master; + +create table t1 (a int); +insert into t1 values (1); + +let $MYSQLD_DATADIR= `select @@datadir`; +flush logs; +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/bug36099.sql + +drop table t1; +--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/bug36099.sql" + +--echo *** must be 1 *** +select * from t1; + +# cleanup + +drop table t1; +remove_file $MYSQLTEST_VARDIR/tmp/bug36099.sql; diff --git a/mysql-test/suite/binlog/t/binlog_reset_master.test b/mysql-test/suite/binlog/t/binlog_reset_master.test new file mode 100644 index 00000000000..b7ad69da3ea --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_reset_master.test @@ -0,0 +1,26 @@ +# ==== Purpose ==== +# +# Test bugs in RESET MASTER. + +--source include/have_debug.inc +--source include/have_log_bin.inc + +####################################################################### +# BUG#12574820: binlog.binlog_tmp_table timing out in daily and weekly trunk run +# Problem: MYSQL_BIN_LOG::reset_logs acquired LOCK_thread_count and +# LOCK_log in the wrong order. This could cause a deadlock when +# RESET MASTER was run concurrently with a disconnecting thread. +####################################################################### + +# We use sleep, not debug_sync, because the sync point needs to be in +# the thread shut down code after the debug sync facility has been +# shut down. +--let $write_var= SET DEBUG="+d,sleep_after_lock_thread_count_before_delete_thd"; CREATE TEMPORARY TABLE test.t1 (a INT); +--let $write_to_file= GENERATE +--disable_query_log +--source include/write_var_to_file.inc +--enable_query_log + +--exec $MYSQL < $write_to_file +RESET MASTER; +--remove_file $write_to_file diff --git a/mysql-test/suite/binlog/t/binlog_row_innodb_stat.test b/mysql-test/suite/binlog/t/binlog_row_cache_stat.test index e4e6762226b..03f9c53f0cc 100644 --- a/mysql-test/suite/binlog/t/binlog_row_innodb_stat.test +++ b/mysql-test/suite/binlog/t/binlog_row_cache_stat.test @@ -2,4 +2,4 @@ # For both statement and row based bin logs 9/19/2005 [jbm] -- source include/have_binlog_format_row.inc --- source extra/binlog_tests/innodb_stat.test +-- source extra/binlog_tests/binlog_cache_stat.test diff --git a/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test b/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test index 6682d84d9c9..2e3e53b86f1 100644 --- a/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test +++ b/mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test @@ -83,17 +83,17 @@ while($i) -- let $flags=--database=b42941 # construct CLI for mysqlbinlog - if(`SELECT $i=3`) + if($i==3) { -- let $flags= $flags --verbose --hexdump } - if(`SELECT $i=2`) + if($i==2) { -- let $flags= $flags --verbose } -# if(`SELECT $i=1`) +# if($i==1) # { # do nothing $flags is already set as it should be # } diff --git a/mysql-test/suite/binlog/t/binlog_server_id.test b/mysql-test/suite/binlog/t/binlog_server_id.test new file mode 100644 index 00000000000..6e98ec6ee6d --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_server_id.test @@ -0,0 +1,29 @@ +# Test for BUG#28908 Replication: set global server_id is not setting the session server_id + +-- source include/have_log_bin.inc + +let $saved_server_id=`select @@server_id`; +set global server_id=1; +reset master; + +-- disable_warnings +drop table if exists t1,t2,t3; +-- enable_warnings + +create table t1 (a int); +select @@server_id; +source include/show_binlog_events2.inc; + +set global server_id=2; +create table t2 (b int); +select @@server_id; +source include/show_binlog_events2.inc; + +set global server_id=3; +create table t3 (c int); +select @@server_id; +source include/show_binlog_events2.inc; + +# cleanup +eval set global server_id=$saved_server_id; +drop table t1,t2,t3; diff --git a/mysql-test/suite/binlog/t/binlog_sf.test b/mysql-test/suite/binlog/t/binlog_sf.test new file mode 100644 index 00000000000..05b31afcb58 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_sf.test @@ -0,0 +1,191 @@ +-- source include/have_log_bin.inc + +# We change binlog format inside the test, so no need to re-run with +# more than one binlog_format. +-- source include/have_binlog_format_statement.inc + +# Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR +# BUG#41166 stored function requires "deterministic" if binlog_format is "statement" + +# save status + +let $oblf=`select @@SESSION.BINLOG_FORMAT`; +let $otfc=`select @@log_bin_trust_function_creators`; + +set global log_bin_trust_function_creators=0; + + + +# fail *on definition* + +set binlog_format=STATEMENT; + +delimiter |; +--error ER_BINLOG_UNSAFE_ROUTINE +create function fn16456() + returns int +begin + return unix_timestamp(); +end| +delimiter ;| + + + +# force in definition, so we can see whether we fail on call + +set global log_bin_trust_function_creators=1; + +delimiter |; +create function fn16456() + returns int +begin + return unix_timestamp(); +end| +delimiter ;| + +set global log_bin_trust_function_creators=0; + + + +# allow funcall in RBR + +set binlog_format=ROW; + +--replace_column 1 timestamp +select fn16456(); + + + +# fail funcall in SBR + +set binlog_format=STATEMENT; + +--error ER_BINLOG_UNSAFE_ROUTINE +select fn16456(); + + + +# clean + +drop function fn16456; + + + +# success in definition with deterministic + +set global log_bin_trust_function_creators=0; + +delimiter |; +create function fn16456() + returns int deterministic +begin + return unix_timestamp(); +end| +delimiter ;| + + + +# allow funcall in RBR + +set binlog_format=ROW; + +--replace_column 1 timestamp +select fn16456(); + + + +# allow funcall in SBR + +set binlog_format=STATEMENT; + +--replace_column 1 timestamp +select fn16456(); + + + +# clean + +drop function fn16456; + + +# success in definition with NO SQL + +set global log_bin_trust_function_creators=0; + +delimiter |; +create function fn16456() + returns int no sql +begin + return unix_timestamp(); +end| +delimiter ;| + + + +# allow funcall in RBR + +set binlog_format=ROW; + +--replace_column 1 timestamp +select fn16456(); + + + +# allow funcall in SBR + +set binlog_format=STATEMENT; + +--replace_column 1 timestamp +select fn16456(); + + +# clean + +drop function fn16456; + + + +# success in definition with reads sql data + +set global log_bin_trust_function_creators=0; + +delimiter |; +create function fn16456() + returns int reads sql data +begin + return unix_timestamp(); +end| +delimiter ;| + + + +# allow funcall in RBR + +set binlog_format=ROW; + +--replace_column 1 timestamp +select fn16456(); + + + +# allow funcall in SBR + +set binlog_format=STATEMENT; + +--replace_column 1 timestamp +select fn16456(); + + + +# clean + +drop function fn16456; + + + +# restore status + +--disable_query_log +eval set binlog_format=$oblf; +eval set global log_bin_trust_function_creators=$otfc; +--enable_query_log diff --git a/mysql-test/suite/binlog/t/binlog_sql_mode.test b/mysql-test/suite/binlog/t/binlog_sql_mode.test index 1777f8cb561..ab4f6450543 100644 --- a/mysql-test/suite/binlog/t/binlog_sql_mode.test +++ b/mysql-test/suite/binlog/t/binlog_sql_mode.test @@ -8,7 +8,6 @@ # Scan binlog file to check if the sql_mode is still set to 0 before generating binlog event # --- source include/master-slave.inc -- source include/have_log_bin.inc # BUG#39526 sql_mode not retained in binary log for CREATE PROCEDURE @@ -50,10 +49,10 @@ CREATE EVENT testEvent ON SCHEDULE END;| DELIMITER ;| ---echo Chceck Result +--echo Check Result let $MYSQLD_DATADIR= `select @@datadir`; ---exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog +--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog")) diff --git a/mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt b/mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt index 099f07e5d4e..62409b9f6be 100644 --- a/mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt +++ b/mysql-test/suite/binlog/t/binlog_stm_binlog-master.opt @@ -1 +1,2 @@ --max_binlog_size=4096 --default-storage-engine=MyISAM +--force-restart diff --git a/mysql-test/suite/binlog/t/binlog_stm_innodb_stat.test b/mysql-test/suite/binlog/t/binlog_stm_cache_stat.test index c6017246e6d..0f5aa9f6013 100644 --- a/mysql-test/suite/binlog/t/binlog_stm_innodb_stat.test +++ b/mysql-test/suite/binlog/t/binlog_stm_cache_stat.test @@ -2,4 +2,4 @@ # For both statement and row based bin logs 9/19/2005 [jbm] -- source include/have_binlog_format_statement.inc --- source extra/binlog_tests/innodb_stat.test +-- source extra/binlog_tests/binlog_cache_stat.test diff --git a/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt b/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt index e2cfcb299cf..2a1187d3fe4 100644 --- a/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt +++ b/mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt @@ -1 +1,2 @@ --binlog-do-db=b42829 +--force-restart diff --git a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test index 35e4dd57877..022341ae833 100644 --- a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test +++ b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test @@ -116,7 +116,7 @@ DROP TABLE t1; SET GLOBAL log_warnings = @old_log_warnings; let $log_error_= `SELECT @@GLOBAL.log_error`; -if(!`select LENGTH('$log_error_')`) +if(!$log_error_) { # MySQL Server on windows is started with --console and thus # does not know the location of its .err log, use default location diff --git a/mysql-test/suite/binlog/t/binlog_unsafe.test b/mysql-test/suite/binlog/t/binlog_unsafe.test index 740649f0053..9fbdc9fc2c8 100644 --- a/mysql-test/suite/binlog/t/binlog_unsafe.test +++ b/mysql-test/suite/binlog/t/binlog_unsafe.test @@ -141,11 +141,11 @@ END| # In each iteration of this loop, we select one method to make the # statement unsafe. --let $unsafe_type= 0 -while (`SELECT $unsafe_type < 9`) { +while ($unsafe_type < 9) { --echo - if (`SELECT $unsafe_type = 0`) { + if ($unsafe_type == 0) { --echo ==== Testing UUID() unsafeness ==== --let $desc_0= unsafe UUID() function --let $stmt_sidef_0= INSERT INTO t0 VALUES (UUID()) @@ -155,7 +155,7 @@ while (`SELECT $unsafe_type < 9`) { --let $CRC_ARG_expected_number_of_warnings= 1 } - if (`SELECT $unsafe_type = 1`) { + if ($unsafe_type == 1) { --echo ==== Testing @@hostname unsafeness ==== --let $desc_0= unsafe @@hostname variable --let $stmt_sidef_0= INSERT INTO t0 VALUES (@@hostname) @@ -168,7 +168,7 @@ while (`SELECT $unsafe_type < 9`) { --let $CRC_ARG_expected_number_of_warnings= 1 } - if (`SELECT $unsafe_type = 2`) { + if ($unsafe_type == 2) { --echo ==== Testing SELECT...LIMIT unsafeness ==== --let $desc_0= unsafe SELECT...LIMIT statement --let $stmt_sidef_0= INSERT INTO t0 SELECT * FROM data_table LIMIT 1 @@ -178,7 +178,7 @@ while (`SELECT $unsafe_type < 9`) { --let $CRC_ARG_expected_number_of_warnings= 1 } - if (`SELECT $unsafe_type = 3`) { + if ($unsafe_type == 3) { --echo ==== Testing INSERT DELAYED safeness after BUG#54579 is fixed ==== --let $desc_0= unsafe INSERT DELAYED statement --let $stmt_sidef_0= INSERT DELAYED INTO t0 VALUES (1), (2) @@ -188,7 +188,7 @@ while (`SELECT $unsafe_type < 9`) { --let $CRC_ARG_expected_number_of_warnings= 0 } - if (`SELECT $unsafe_type = 4`) { + if ($unsafe_type == 4) { --echo ==== Testing unsafeness of insert of two autoinc values ==== --let $desc_0= unsafe update of two autoinc columns --let $stmt_sidef_0= INSERT INTO double_autoinc_table VALUES (NULL) @@ -198,7 +198,7 @@ while (`SELECT $unsafe_type < 9`) { --let $CRC_ARG_expected_number_of_warnings= 1 } - if (`SELECT $unsafe_type = 5`) { + if ($unsafe_type == 5) { --echo ==== Testing unsafeness of UDF's ==== --let $desc_0= unsafe UDF --let $stmt_sidef_0= INSERT INTO t0 VALUES (myfunc_int(10)) @@ -208,7 +208,7 @@ while (`SELECT $unsafe_type < 9`) { --let $CRC_ARG_expected_number_of_warnings= 1 } - if (`SELECT $unsafe_type = 6`) { + if ($unsafe_type == 6) { --echo ==== Testing unsafeness of access to mysql.general_log ==== --let $desc_0= unsafe use of mysql.general_log --let $stmt_sidef_0= INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log @@ -218,7 +218,7 @@ while (`SELECT $unsafe_type < 9`) { --let $CRC_ARG_expected_number_of_warnings= 1 } - if (`SELECT $unsafe_type = 7`) { + if ($unsafe_type == 7) { --echo ==== Testing a statement that is unsafe in many ways ==== --let $desc_0= statement that is unsafe in many ways # Concatenate three unsafe values, and then concatenate NULL to @@ -230,7 +230,7 @@ while (`SELECT $unsafe_type < 9`) { --let $CRC_ARG_expected_number_of_warnings= 6 } - if (`SELECT $unsafe_type = 8`) { + if ($unsafe_type == 8) { --echo ==== Testing a statement that is unsafe several times ==== --let $desc_0= statement that is unsafe several times --let $stmt_sidef_0= INSERT INTO ta0 VALUES (multi_unsafe_func()) @@ -249,7 +249,7 @@ while (`SELECT $unsafe_type < 9`) { # construct. Instead, we just invoke the unsafe statement directly. --let $call_type_1= 0 - while (`SELECT $call_type_1 < 8`) { + while ($call_type_1 < 8) { #--echo debug: level 1, types $call_type_1 -> $unsafe_type --let $CRC_ARG_level= 1 --let $CRC_ARG_type= $call_type_1 @@ -280,7 +280,7 @@ while (`SELECT $unsafe_type < 9`) { # construct. --let $call_type_2= 0 - while (`SELECT $call_type_2 < 7`) { + while ($call_type_2 < 7) { #--echo debug: level 2, types $call_type_2 -> $call_type_1 -> $unsafe_type --let $CRC_ARG_level= 2 --let $CRC_ARG_type= $call_type_2 @@ -309,7 +309,7 @@ while (`SELECT $unsafe_type < 9`) { # construct. --let $call_type_3= 0 - while (`SELECT $call_type_3 < 7`) { + while ($call_type_3 < 7) { #--echo debug: level 3, types $call_type_2 -> $call_type_2 -> $call_type_1 -> $unsafe_type --let $CRC_ARG_level= 3 --let $CRC_ARG_type= $call_type_3 @@ -321,7 +321,7 @@ while (`SELECT $unsafe_type < 9`) { --source extra/rpl_tests/create_recursive_construct.inc # Drop created object. - if (`SELECT '$drop_3' != ''`) { + if ($drop_3) { --eval $drop_3 } --inc $call_type_3 @@ -330,7 +330,7 @@ while (`SELECT $unsafe_type < 9`) { } # if (!is_toplevel_2) # Drop created object. - if (`SELECT '$drop_2' != ''`) { + if ($drop_2) { --eval $drop_2 } --inc $call_type_2 @@ -338,7 +338,7 @@ while (`SELECT $unsafe_type < 9`) { } # if (!is_toplevel_1) # Drop created object. - if (`SELECT '$drop_1' != ''`) { + if ($drop_1) { --eval $drop_1 } --inc $call_type_1 @@ -481,7 +481,7 @@ DROP TABLE t1,t2; --echo "Should NOT have any warning message issued in the following func7() and trig" CREATE TABLE t1 (a INT); -CREATE TABLE t2 (a CHAR(40)); +CREATE TABLE t2 (a TEXT); CREATE TABLE trigger_table (a CHAR(7)); DELIMITER |; CREATE FUNCTION func7() diff --git a/mysql-test/suite/binlog/t/disabled.def b/mysql-test/suite/binlog/t/disabled.def index a9841f592f8..1abc9951322 100644 --- a/mysql-test/suite/binlog/t/disabled.def +++ b/mysql-test/suite/binlog/t/disabled.def @@ -9,6 +9,5 @@ # Do not use any TAB characters for whitespace. # ############################################################################## - -binlog_truncate_innodb : BUG#42643 2009-02-06 mats Changes to InnoDB requires to complete fix for BUG#36763 -binlog_spurious_ddl_errors : BUG#54195 2010-06-03 alik binlog_spurious_ddl_errors.test fails, thus disabled +binlog_truncate_innodb : BUG#11764459 2010-10-20 anitha Originally disabled due to BUG#42643. Product bug fixed, but test changes needed +binlog_spurious_ddl_errors : BUG#11761680 2010-06-03 alik binlog_spurious_ddl_errors.test fails, thus disabled |