summaryrefslogtreecommitdiff
path: root/mysql-test/suite
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite')
-rw-r--r--mysql-test/suite/binlog/r/binlog_sql_mode.result111
-rw-r--r--mysql-test/suite/binlog/t/binlog_sql_mode.test96
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug11766634.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug13635833.result45
-rw-r--r--mysql-test/suite/innodb/t/disabled.def7
-rw-r--r--mysql-test/suite/innodb/t/innodb-lock.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug11766634.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug11766634.test55
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug13635833.test69
-rw-r--r--mysql-test/suite/innodb/t/innodb_replace.test5
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug11766634.result6
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug13635833.result45
-rw-r--r--mysql-test/suite/innodb_plugin/t/disabled.def9
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-index.test5
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-lock.test5
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug11766634.opt1
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug11766634.test55
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug13635833.test71
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug34300.test1
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug52745.test5
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_replace.test5
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_relay_ign_space.result5
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_relay_ign_space-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test101
24 files changed, 708 insertions, 7 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_sql_mode.result b/mysql-test/suite/binlog/r/binlog_sql_mode.result
index 4477c94a95e..1aea77c4a4b 100644
--- a/mysql-test/suite/binlog/r/binlog_sql_mode.result
+++ b/mysql-test/suite/binlog/r/binlog_sql_mode.result
@@ -38,3 +38,114 @@ DROP VIEW testView;
DROP TABLE t1;
SET @@global.sql_mode= @old_sql_mode;
SET @@session.binlog_format=@old_binlog_format;
+
+#
+# Test for Bug#12601974 - STORED PROCEDURE SQL_MODE=NO_BACKSLASH_ESCAPES
+# IGNORED AND BREAKS REPLICATION
+#
+DROP DATABASE IF EXISTS mysqltest_db;
+DROP TABLE IF EXISTS test_table;
+CREATE DATABASE mysqltest_db;
+USE mysqltest_db;
+CREATE TABLE test_table (c1 CHAR(50));
+SET @org_mode=@@sql_mode;
+SET @@sql_mode='';
+CREATE PROCEDURE proc_without_sql_mode (IN param1 CHAR(50), IN param2 CHAR(50))
+BEGIN
+DECLARE var1 CHAR(50) DEFAULT param1;
+DECLARE var2 CHAR(50) DEFAULT param2;
+DECLARE var3 CHAR(50) DEFAULT 'abcd\bef';
+DECLARE var4 CHAR(50) DEFAULT 'abcd\nef';
+DECLARE var5 CHAR(50) DEFAULT 'abcd\ref';
+DECLARE var6 CHAR(50) DEFAULT 'abcd\tef';
+DECLARE var7 CHAR(50) DEFAULT 'abcd\\ef';
+DECLARE var8 CHAR(50) DEFAULT 'abcd\%ef';
+DECLARE var9 CHAR(50) DEFAULT 'abcd\_ef';
+INSERT INTO test_table VALUES (var1);
+INSERT INTO test_table VALUES (var2);
+INSERT INTO test_table VALUES (var3);
+INSERT INTO test_table VALUES (var4);
+INSERT INTO test_table VALUES (var5);
+INSERT INTO test_table VALUES (var6);
+INSERT INTO test_table VALUES (var7);
+INSERT INTO test_table VALUES (var8);
+INSERT INTO test_table VALUES (var9);
+END
+$
+SET @@sql_mode='NO_BACKSLASH_ESCAPES'$
+CREATE PROCEDURE proc_with_sql_mode (IN param1 CHAR(50), IN param2 CHAR(50))
+BEGIN
+DECLARE var1 CHAR(50) DEFAULT param1;
+DECLARE var2 CHAR(50) DEFAULT param2;
+DECLARE var3 CHAR(50) DEFAULT 'wxyz\bef';
+DECLARE var4 CHAR(50) DEFAULT 'wxyz\nef';
+DECLARE var5 CHAR(50) DEFAULT 'wxyz\ref';
+DECLARE var6 CHAR(50) DEFAULT 'wxyz\tef';
+DECLARE var7 CHAR(50) DEFAULT 'wxyz\\ef';
+DECLARE var8 CHAR(50) DEFAULT 'wxyz\%ef';
+DECLARE var9 CHAR(50) DEFAULT 'wxyz\_ef';
+INSERT INTO test_table VALUES (var1);
+INSERT INTO test_table VALUES (var2);
+INSERT INTO test_table VALUES (var3);
+INSERT INTO test_table VALUES (var4);
+INSERT INTO test_table VALUES (var5);
+INSERT INTO test_table VALUES (var6);
+INSERT INTO test_table VALUES (var7);
+INSERT INTO test_table VALUES (var8);
+INSERT INTO test_table VALUES (var9);
+END
+$
+SET @@sql_mode='';
+CALL proc_without_sql_mode('abcd\'ef', 'abcd\"ef');
+CALL proc_with_sql_mode('wxyz\'ef', 'wxyz\"ef');
+SELECT * FROM test_table;
+c1
+abcd'ef
+abcd"ef
+abcdef
+abcd
+ef
+abcd ef
+abcd ef
+abcd\ef
+abcd\%ef
+abcd\_ef
+wxyz'ef
+wxyz"ef
+wxyz\bef
+wxyz\nef
+wxyz\ref
+wxyz\tef
+wxyz\\ef
+wxyz\%ef
+wxyz\_ef
+"Dropping table test_table"
+DROP TABLE test_table;
+#"test_table" content after replaying the binlog
+SELECT * FROM test_table;
+c1
+abcd'ef
+abcd"ef
+abcdef
+abcd
+ef
+abcd ef
+abcd ef
+abcd\ef
+abcd\%ef
+abcd\_ef
+wxyz'ef
+wxyz"ef
+wxyz\bef
+wxyz\nef
+wxyz\ref
+wxyz\tef
+wxyz\\ef
+wxyz\%ef
+wxyz\_ef
+#Clean up
+DROP DATABASE mysqltest_db;
+SET @@sql_mode= @org_mode;
+use test;
+
+#End of Test for Bug#12601974
diff --git a/mysql-test/suite/binlog/t/binlog_sql_mode.test b/mysql-test/suite/binlog/t/binlog_sql_mode.test
index ab4f6450543..167c8f5a96d 100644
--- a/mysql-test/suite/binlog/t/binlog_sql_mode.test
+++ b/mysql-test/suite/binlog/t/binlog_sql_mode.test
@@ -73,3 +73,99 @@ DROP TABLE t1;
SET @@global.sql_mode= @old_sql_mode;
SET @@session.binlog_format=@old_binlog_format;
+
+--echo
+--echo #
+--echo # Test for Bug#12601974 - STORED PROCEDURE SQL_MODE=NO_BACKSLASH_ESCAPES
+--echo # IGNORED AND BREAKS REPLICATION
+--echo #
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest_db;
+DROP TABLE IF EXISTS test_table;
+--enable_warnings
+
+CREATE DATABASE mysqltest_db;
+USE mysqltest_db;
+CREATE TABLE test_table (c1 CHAR(50));
+
+SET @org_mode=@@sql_mode;
+
+SET @@sql_mode='';
+DELIMITER $;
+CREATE PROCEDURE proc_without_sql_mode (IN param1 CHAR(50), IN param2 CHAR(50))
+BEGIN
+ DECLARE var1 CHAR(50) DEFAULT param1;
+ DECLARE var2 CHAR(50) DEFAULT param2;
+ DECLARE var3 CHAR(50) DEFAULT 'abcd\bef';
+ DECLARE var4 CHAR(50) DEFAULT 'abcd\nef';
+ DECLARE var5 CHAR(50) DEFAULT 'abcd\ref';
+ DECLARE var6 CHAR(50) DEFAULT 'abcd\tef';
+ DECLARE var7 CHAR(50) DEFAULT 'abcd\\ef';
+ DECLARE var8 CHAR(50) DEFAULT 'abcd\%ef';
+ DECLARE var9 CHAR(50) DEFAULT 'abcd\_ef';
+
+ INSERT INTO test_table VALUES (var1);
+ INSERT INTO test_table VALUES (var2);
+ INSERT INTO test_table VALUES (var3);
+ INSERT INTO test_table VALUES (var4);
+ INSERT INTO test_table VALUES (var5);
+ INSERT INTO test_table VALUES (var6);
+ INSERT INTO test_table VALUES (var7);
+ INSERT INTO test_table VALUES (var8);
+ INSERT INTO test_table VALUES (var9);
+END
+$
+
+SET @@sql_mode='NO_BACKSLASH_ESCAPES'$
+CREATE PROCEDURE proc_with_sql_mode (IN param1 CHAR(50), IN param2 CHAR(50))
+BEGIN
+ DECLARE var1 CHAR(50) DEFAULT param1;
+ DECLARE var2 CHAR(50) DEFAULT param2;
+ DECLARE var3 CHAR(50) DEFAULT 'wxyz\bef';
+ DECLARE var4 CHAR(50) DEFAULT 'wxyz\nef';
+ DECLARE var5 CHAR(50) DEFAULT 'wxyz\ref';
+ DECLARE var6 CHAR(50) DEFAULT 'wxyz\tef';
+ DECLARE var7 CHAR(50) DEFAULT 'wxyz\\ef';
+ DECLARE var8 CHAR(50) DEFAULT 'wxyz\%ef';
+ DECLARE var9 CHAR(50) DEFAULT 'wxyz\_ef';
+
+ INSERT INTO test_table VALUES (var1);
+ INSERT INTO test_table VALUES (var2);
+ INSERT INTO test_table VALUES (var3);
+ INSERT INTO test_table VALUES (var4);
+ INSERT INTO test_table VALUES (var5);
+ INSERT INTO test_table VALUES (var6);
+ INSERT INTO test_table VALUES (var7);
+ INSERT INTO test_table VALUES (var8);
+ INSERT INTO test_table VALUES (var9);
+END
+$
+
+DELIMITER ;$
+SET @@sql_mode='';
+CALL proc_without_sql_mode('abcd\'ef', 'abcd\"ef');
+CALL proc_with_sql_mode('wxyz\'ef', 'wxyz\"ef');
+SELECT * FROM test_table;
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $MYSQL_BINLOG --force-if-open -d mysqltest_db $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug12601974.binlog
+
+--echo "Dropping table test_table"
+DROP TABLE test_table;
+
+--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug12601974.binlog"
+
+--echo #"test_table" content after replaying the binlog
+SELECT * FROM test_table;
+
+--echo #Clean up
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug12601974.binlog
+DROP DATABASE mysqltest_db;
+SET @@sql_mode= @org_mode;
+use test;
+
+--echo
+--echo #End of Test for Bug#12601974
+
+
diff --git a/mysql-test/suite/innodb/r/innodb_bug11766634.result b/mysql-test/suite/innodb/r/innodb_bug11766634.result
new file mode 100644
index 00000000000..90ce5315598
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug11766634.result
@@ -0,0 +1,6 @@
+create table t1 (f1 char(255)) engine innodb;
+ibdata1 size: 27262976 bytes
+drop table t1;
+create table t1 (f1 char(255)) engine innodb;
+ibdata1 size: 27262976 bytes
+drop table t1;
diff --git a/mysql-test/suite/innodb/r/innodb_bug13635833.result b/mysql-test/suite/innodb/r/innodb_bug13635833.result
new file mode 100644
index 00000000000..e9107d5c125
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug13635833.result
@@ -0,0 +1,45 @@
+SET DEBUG_SYNC='reset';
+create table t1 (f1 integer, key k1 (f1)) engine=innodb;
+create table t2 (f1 int, f2 int, key(f1), key(f2)) engine=innodb;
+create table t3 (f2 int, key(f2)) engine=innodb;
+insert into t1 values (10);
+insert into t2 values (10, 20);
+insert into t3 values (20);
+alter table t2 add constraint c1 foreign key (f1)
+references t1(f1) on update cascade;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ KEY `k1` (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` int(11) DEFAULT NULL,
+ KEY `f1` (`f1`),
+ KEY `f2` (`f2`),
+ CONSTRAINT `c1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`) ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `f2` int(11) DEFAULT NULL,
+ KEY `f2` (`f2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SET DEBUG_SYNC='alter_table_before_rename_result_table
+ SIGNAL update_can_proceed WAIT_FOR dict_unfreeze';
+alter table t2 add constraint z1 foreign key (f2)
+references t3(f2) on update cascade;
+SET DEBUG_SYNC='innodb_row_update_for_mysql_begin
+ WAIT_FOR update_can_proceed';
+SET DEBUG_SYNC='innodb_dml_cascade_dict_unfreeze SIGNAL dict_unfreeze
+ WAIT_FOR foreign_free_cache';
+update ignore t1 set f1 = 20;
+ERROR HY000: Error on rename of './test/t2' to '#sql2-temporary' (errno: 181)
+SET DEBUG_SYNC='now SIGNAL foreign_free_cache';
+drop table t2;
+drop table t1;
+drop table t3;
+SET DEBUG_SYNC='reset';
diff --git a/mysql-test/suite/innodb/t/disabled.def b/mysql-test/suite/innodb/t/disabled.def
index 6536c0221f8..7bc399c94a6 100644
--- a/mysql-test/suite/innodb/t/disabled.def
+++ b/mysql-test/suite/innodb/t/disabled.def
@@ -10,6 +10,7 @@
#
##############################################################################
-#innodb_bug53756 : Waiting for merge with Percona Server; bug fixed in innodb_plugin in MySQL 5.1.50
-innodb-lock: Disabled until merging with XtraDB 5.1.60
-innodb_replace: Disabled until merging with XtraDB 5.1.60
+#
+# instead of disabling innodb tests that are not fixed in xtradb yet
+# add --skip inside if() into the test file itself
+#
diff --git a/mysql-test/suite/innodb/t/innodb-lock.test b/mysql-test/suite/innodb/t/innodb-lock.test
index 8e4dd80e07e..9952603f372 100644
--- a/mysql-test/suite/innodb/t/innodb-lock.test
+++ b/mysql-test/suite/innodb/t/innodb-lock.test
@@ -1,5 +1,10 @@
-- source include/have_innodb.inc
+if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
+{
+ --skip Not fixed in XtraDB 1.0.17-13.0 or earlier
+}
+
#
# Check and select innodb lock type
#
diff --git a/mysql-test/suite/innodb/t/innodb_bug11766634.opt b/mysql-test/suite/innodb/t/innodb_bug11766634.opt
new file mode 100644
index 00000000000..cef79bc8585
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug11766634.opt
@@ -0,0 +1 @@
+--force-restart
diff --git a/mysql-test/suite/innodb/t/innodb_bug11766634.test b/mysql-test/suite/innodb/t/innodb_bug11766634.test
new file mode 100644
index 00000000000..91be4da0338
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug11766634.test
@@ -0,0 +1,55 @@
+# Bug 11766634 59783: InnoDB data grows unexpectedly when inserting,
+# truncating, inserting the same set of rows.
+#
+# Scenario:
+# create table t1. Insert $recs records. check size of ibdata1.
+# drop table t1. create table t1. Insert the same set of $recs
+# records. The size of ibdata1 must not increase.
+#
+
+-- source include/not_embedded.inc
+-- source include/have_innodb.inc
+
+create table t1 (f1 char(255)) engine innodb;
+let $MYSQLD_DATADIR=`select @@datadir`;
+let IBDATA1=$MYSQLD_DATADIR/ibdata1;
+
+let $recs = 36262;
+
+--disable_query_log
+let $c = $recs;
+start transaction;
+while ($c)
+{
+ insert into t1 values ('Hello World');
+ dec $c;
+}
+commit work;
+--enable_query_log
+
+perl;
+my $filesize = -s $ENV{'IBDATA1'};
+print "ibdata1 size: $filesize bytes\n";
+EOF
+
+drop table t1;
+create table t1 (f1 char(255)) engine innodb;
+
+--disable_query_log
+let $c = $recs;
+start transaction;
+while ($c)
+{
+ insert into t1 values ('Hello World');
+ dec $c;
+}
+commit work;
+--enable_query_log
+
+perl;
+my $filesize = -s $ENV{'IBDATA1'};
+print "ibdata1 size: $filesize bytes\n";
+EOF
+
+drop table t1;
+
diff --git a/mysql-test/suite/innodb/t/innodb_bug13635833.test b/mysql-test/suite/innodb/t/innodb_bug13635833.test
new file mode 100644
index 00000000000..5695e0c1f26
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug13635833.test
@@ -0,0 +1,69 @@
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+--source include/not_embedded.inc
+
+if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
+{
+ --skip Not fixed in XtraDB 1.0.17-13.0 or earlier
+}
+
+SET DEBUG_SYNC='reset';
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+create table t1 (f1 integer, key k1 (f1)) engine=innodb;
+create table t2 (f1 int, f2 int, key(f1), key(f2)) engine=innodb;
+create table t3 (f2 int, key(f2)) engine=innodb;
+
+insert into t1 values (10);
+insert into t2 values (10, 20);
+insert into t3 values (20);
+
+alter table t2 add constraint c1 foreign key (f1)
+ references t1(f1) on update cascade;
+
+show create table t1;
+show create table t2;
+show create table t3;
+
+SET DEBUG_SYNC='alter_table_before_rename_result_table
+ SIGNAL update_can_proceed WAIT_FOR dict_unfreeze';
+
+--send
+alter table t2 add constraint z1 foreign key (f2)
+ references t3(f2) on update cascade;
+
+connect (thr2,localhost,root,,);
+connection thr2;
+
+SET DEBUG_SYNC='innodb_row_update_for_mysql_begin
+ WAIT_FOR update_can_proceed';
+SET DEBUG_SYNC='innodb_dml_cascade_dict_unfreeze SIGNAL dict_unfreeze
+ WAIT_FOR foreign_free_cache';
+
+--send
+update ignore t1 set f1 = 20;
+
+connection default;
+--replace_regex /'[^']*test\/#sql2-[0-9a-f-]*'/'#sql2-temporary'/
+--error ER_ERROR_ON_RENAME
+reap;
+
+SET DEBUG_SYNC='now SIGNAL foreign_free_cache';
+
+connection thr2;
+reap;
+disconnect thr2;
+--source include/wait_until_disconnected.inc
+
+connection default;
+
+drop table t2;
+drop table t1;
+drop table t3;
+
+# Wait till we reached the initial number of concurrent sessions
+--source include/wait_until_count_sessions.inc
+
+SET DEBUG_SYNC='reset';
diff --git a/mysql-test/suite/innodb/t/innodb_replace.test b/mysql-test/suite/innodb/t/innodb_replace.test
index a35f423c85e..30e47042d92 100644
--- a/mysql-test/suite/innodb/t/innodb_replace.test
+++ b/mysql-test/suite/innodb/t/innodb_replace.test
@@ -1,6 +1,11 @@
--source include/have_innodb.inc
--source include/have_debug_sync.inc
+if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
+{
+ --skip Not fixed in XtraDB 1.0.17-13.0 or earlier
+}
+
--echo #
--echo #Bug#11759688 52020: InnoDB can still deadlock
--echo #on just INSERT...ON DUPLICATE KEY
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug11766634.result b/mysql-test/suite/innodb_plugin/r/innodb_bug11766634.result
new file mode 100644
index 00000000000..90ce5315598
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug11766634.result
@@ -0,0 +1,6 @@
+create table t1 (f1 char(255)) engine innodb;
+ibdata1 size: 27262976 bytes
+drop table t1;
+create table t1 (f1 char(255)) engine innodb;
+ibdata1 size: 27262976 bytes
+drop table t1;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug13635833.result b/mysql-test/suite/innodb_plugin/r/innodb_bug13635833.result
new file mode 100644
index 00000000000..e9107d5c125
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug13635833.result
@@ -0,0 +1,45 @@
+SET DEBUG_SYNC='reset';
+create table t1 (f1 integer, key k1 (f1)) engine=innodb;
+create table t2 (f1 int, f2 int, key(f1), key(f2)) engine=innodb;
+create table t3 (f2 int, key(f2)) engine=innodb;
+insert into t1 values (10);
+insert into t2 values (10, 20);
+insert into t3 values (20);
+alter table t2 add constraint c1 foreign key (f1)
+references t1(f1) on update cascade;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ KEY `k1` (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` int(11) DEFAULT NULL,
+ KEY `f1` (`f1`),
+ KEY `f2` (`f2`),
+ CONSTRAINT `c1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`) ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `f2` int(11) DEFAULT NULL,
+ KEY `f2` (`f2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SET DEBUG_SYNC='alter_table_before_rename_result_table
+ SIGNAL update_can_proceed WAIT_FOR dict_unfreeze';
+alter table t2 add constraint z1 foreign key (f2)
+references t3(f2) on update cascade;
+SET DEBUG_SYNC='innodb_row_update_for_mysql_begin
+ WAIT_FOR update_can_proceed';
+SET DEBUG_SYNC='innodb_dml_cascade_dict_unfreeze SIGNAL dict_unfreeze
+ WAIT_FOR foreign_free_cache';
+update ignore t1 set f1 = 20;
+ERROR HY000: Error on rename of './test/t2' to '#sql2-temporary' (errno: 181)
+SET DEBUG_SYNC='now SIGNAL foreign_free_cache';
+drop table t2;
+drop table t1;
+drop table t3;
+SET DEBUG_SYNC='reset';
diff --git a/mysql-test/suite/innodb_plugin/t/disabled.def b/mysql-test/suite/innodb_plugin/t/disabled.def
index 72fec47a09a..1b87b85b060 100644
--- a/mysql-test/suite/innodb_plugin/t/disabled.def
+++ b/mysql-test/suite/innodb_plugin/t/disabled.def
@@ -10,7 +10,8 @@
#
##############################################################################
-innodb_bug52745: Disabled as this has valgrind failures (also in MySQL 5.1.50)
-innodb-index: Disabled until merging with XtraDB 5.1.60
-innodb-lock: Disabled until merging with XtraDB 5.1.60
-innodb_replace: Disabled until merging with XtraDB 5.1.60
+#
+# instead of disabling innodb tests that are not fixed in xtradb yet
+# add --skip inside if() into the test file itself
+#
+
diff --git a/mysql-test/suite/innodb_plugin/t/innodb-index.test b/mysql-test/suite/innodb_plugin/t/innodb-index.test
index d4310093bfd..a0a525f2765 100644
--- a/mysql-test/suite/innodb_plugin/t/innodb-index.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb-index.test
@@ -1,5 +1,10 @@
-- source include/have_innodb_plugin.inc
+if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
+{
+ --skip Not fixed in XtraDB 1.0.17-13.0 or earlier
+}
+
let $MYSQLD_DATADIR= `select @@datadir`;
let $per_table=`select @@innodb_file_per_table`;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb-lock.test b/mysql-test/suite/innodb_plugin/t/innodb-lock.test
index 2198c02efb0..4ce7c95b6c5 100644
--- a/mysql-test/suite/innodb_plugin/t/innodb-lock.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb-lock.test
@@ -1,5 +1,10 @@
-- source include/have_innodb_plugin.inc
+if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
+{
+ --skip Not fixed in XtraDB 1.0.17-13.0 or earlier
+}
+
#
# Check and select innodb lock type
#
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug11766634.opt b/mysql-test/suite/innodb_plugin/t/innodb_bug11766634.opt
new file mode 100644
index 00000000000..cef79bc8585
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug11766634.opt
@@ -0,0 +1 @@
+--force-restart
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug11766634.test b/mysql-test/suite/innodb_plugin/t/innodb_bug11766634.test
new file mode 100644
index 00000000000..cd46deb64fb
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug11766634.test
@@ -0,0 +1,55 @@
+# Bug 11766634 59783: InnoDB data grows unexpectedly when inserting,
+# truncating, inserting the same set of rows.
+#
+# Scenario:
+# create table t1. Insert $recs records. check size of ibdata1.
+# drop table t1. create table t1. Insert the same set of $recs
+# records. The size of ibdata1 must not increase.
+#
+
+-- source include/not_embedded.inc
+-- source include/have_innodb_plugin.inc
+
+create table t1 (f1 char(255)) engine innodb;
+let $MYSQLD_DATADIR=`select @@datadir`;
+let IBDATA1=$MYSQLD_DATADIR/ibdata1;
+
+let $recs = 36262;
+
+--disable_query_log
+let $c = $recs;
+start transaction;
+while ($c)
+{
+ insert into t1 values ('Hello World');
+ dec $c;
+}
+commit work;
+--enable_query_log
+
+perl;
+my $filesize = -s $ENV{'IBDATA1'};
+print "ibdata1 size: $filesize bytes\n";
+EOF
+
+drop table t1;
+create table t1 (f1 char(255)) engine innodb;
+
+--disable_query_log
+let $c = $recs;
+start transaction;
+while ($c)
+{
+ insert into t1 values ('Hello World');
+ dec $c;
+}
+commit work;
+--enable_query_log
+
+perl;
+my $filesize = -s $ENV{'IBDATA1'};
+print "ibdata1 size: $filesize bytes\n";
+EOF
+
+drop table t1;
+
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug13635833.test b/mysql-test/suite/innodb_plugin/t/innodb_bug13635833.test
new file mode 100644
index 00000000000..adaf59644ba
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug13635833.test
@@ -0,0 +1,71 @@
+--source include/have_innodb_plugin.inc
+--source include/have_debug_sync.inc
+--source include/not_embedded.inc
+# InnoDB Plugin cannot use DEBUG_SYNC on Windows
+--source include/not_windows.inc
+
+if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
+{
+ --skip Not fixed in XtraDB 1.0.17-13.0 or earlier
+}
+
+SET DEBUG_SYNC='reset';
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+create table t1 (f1 integer, key k1 (f1)) engine=innodb;
+create table t2 (f1 int, f2 int, key(f1), key(f2)) engine=innodb;
+create table t3 (f2 int, key(f2)) engine=innodb;
+
+insert into t1 values (10);
+insert into t2 values (10, 20);
+insert into t3 values (20);
+
+alter table t2 add constraint c1 foreign key (f1)
+ references t1(f1) on update cascade;
+
+show create table t1;
+show create table t2;
+show create table t3;
+
+SET DEBUG_SYNC='alter_table_before_rename_result_table
+ SIGNAL update_can_proceed WAIT_FOR dict_unfreeze';
+
+--send
+alter table t2 add constraint z1 foreign key (f2)
+ references t3(f2) on update cascade;
+
+connect (thr2,localhost,root,,);
+connection thr2;
+
+SET DEBUG_SYNC='innodb_row_update_for_mysql_begin
+ WAIT_FOR update_can_proceed';
+SET DEBUG_SYNC='innodb_dml_cascade_dict_unfreeze SIGNAL dict_unfreeze
+ WAIT_FOR foreign_free_cache';
+
+--send
+update ignore t1 set f1 = 20;
+
+connection default;
+--replace_regex /'[^']*test\/#sql2-[0-9a-f-]*'/'#sql2-temporary'/
+--error ER_ERROR_ON_RENAME
+reap;
+
+SET DEBUG_SYNC='now SIGNAL foreign_free_cache';
+
+connection thr2;
+reap;
+disconnect thr2;
+--source include/wait_until_disconnected.inc
+
+connection default;
+
+drop table t2;
+drop table t1;
+drop table t3;
+
+# Wait till we reached the initial number of concurrent sessions
+--source include/wait_until_count_sessions.inc
+
+SET DEBUG_SYNC='reset';
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug34300.test b/mysql-test/suite/innodb_plugin/t/innodb_bug34300.test
index 8be53f0db30..6684ba692c8 100644
--- a/mysql-test/suite/innodb_plugin/t/innodb_bug34300.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug34300.test
@@ -8,6 +8,7 @@
-- disable_query_log
-- disable_result_log
call mtr.add_suppression("InnoDB: Warning: a long semaphore wait:");
+call mtr.add_suppression("the age of the last checkpoint is");
# set packet size and reconnect
let $max_packet=`select @@global.max_allowed_packet`;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug52745.test b/mysql-test/suite/innodb_plugin/t/innodb_bug52745.test
index d118dfd6b93..455f0522684 100644
--- a/mysql-test/suite/innodb_plugin/t/innodb_bug52745.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug52745.test
@@ -2,6 +2,11 @@
let collation=utf8_persian_ci;
--source include/have_collation.inc
+if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
+{
+ --skip Not fixed in XtraDB 1.0.17-13.0 or earlier
+}
+
let $file_format=`select @@innodb_file_format`;
let $file_per_table=`select @@innodb_file_per_table`;
SET GLOBAL innodb_file_format='Barracuda';
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_replace.test b/mysql-test/suite/innodb_plugin/t/innodb_replace.test
index f052edd1d24..797e85a2b85 100644
--- a/mysql-test/suite/innodb_plugin/t/innodb_replace.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_replace.test
@@ -1,6 +1,11 @@
--source include/have_innodb_plugin.inc
--source include/have_debug_sync.inc
+if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
+{
+ --skip Not fixed in XtraDB 1.0.17-13.0 or earlier
+}
+
--echo #
--echo #Bug#11759688 52020: InnoDB can still deadlock
--echo #on just INSERT...ON DUPLICATE KEY
diff --git a/mysql-test/suite/rpl/r/rpl_stm_relay_ign_space.result b/mysql-test/suite/rpl/r/rpl_stm_relay_ign_space.result
new file mode 100644
index 00000000000..7820f1ef97f
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stm_relay_ign_space.result
@@ -0,0 +1,5 @@
+include/master-slave.inc
+[connection master]
+include/assert.inc [Assert that relay log space is close to the limit]
+include/diff_tables.inc [master:test.t1,slave:test.t1]
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space-slave.opt b/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space-slave.opt
new file mode 100644
index 00000000000..f780540aba8
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space-slave.opt
@@ -0,0 +1 @@
+--relay-log-space-limit=8192 --relay-log-purge --max-relay-log-size=4096
diff --git a/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test b/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test
new file mode 100644
index 00000000000..c90bcfea1b7
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_relay_ign_space.test
@@ -0,0 +1,101 @@
+#
+# BUG#12400313 / BUG#64503 test case
+#
+#
+# Description
+# -----------
+#
+# This test case starts the slave server with:
+# --relay-log-space-limit=8192 --relay-log-purge --max-relay-log-size=4096
+#
+# Then it issues some queries that will cause the slave to reach
+# relay-log-space-limit. We lock the table so that the SQL thread is
+# not able to purge the log and then we issue some more statements.
+#
+# The purpose is to show that the IO thread will honor the limits
+# while the SQL thread is not able to purge the relay logs, which did
+# not happen before this patch. In addition we assert that while
+# ignoring the limit (SQL thread needs to rotate before purging), the
+# IO thread does not do it in an uncontrolled manner.
+
+--source include/have_binlog_format_statement.inc
+--source include/master-slave.inc
+--source include/have_innodb.inc
+
+--disable_query_log
+CREATE TABLE t1 (c1 TEXT) engine=InnoDB;
+
+INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
+
+--sync_slave_with_master
+
+# wait for the SQL thread to sleep
+--let $show_statement= SHOW PROCESSLIST
+--let $field= State
+--let $condition= = 'Has read all relay log; waiting for the slave I/O thread to update it'
+--source include/wait_show_condition.inc
+
+# now the io thread has set rli->ignore_space_limit
+# lets lock the table so that once the SQL thread awakes
+# it blocks there and does not set rli->ignore_space_limit
+# back to zero
+LOCK TABLE t1 WRITE;
+
+# now issue more statements that will overflow the
+# rli->log_space_limit (in this case ~10K)
+--connection master
+
+INSERT INTO t1 VALUES ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
+
+--connection slave
+
+# ASSERT that the IO thread waits for the SQL thread to release some
+# space before continuing
+--let $show_statement= SHOW PROCESSLIST
+--let $field= State
+--let $condition= LIKE 'Waiting for %'
+# before the patch (IO would have transfered everything)
+#--let $condition= = 'Waiting for master to send event'
+# after the patch (now it waits for space to be freed)
+#--let $condition= = 'Waiting for the slave SQL thread to free enough relay log space'
+--source include/wait_show_condition.inc
+
+# without the patch we can uncomment the following two lines and
+# watch the IO thread synchronize with the master, thus writing
+# relay logs way over the space limit
+#--connection master
+#--source include/sync_slave_io_with_master.inc
+
+## ASSERT that the IO thread has honored the limit+few bytes required to be able to purge
+--let $relay_log_space_while_sql_is_executing = query_get_value(SHOW SLAVE STATUS, Relay_Log_Space, 1)
+--let $relay_log_space_limit = query_get_value(SHOW VARIABLES LIKE "relay_log_space_limit", Value, 1)
+--let $assert_text= Assert that relay log space is close to the limit
+--let $assert_cond= $relay_log_space_while_sql_is_executing <= $relay_log_space_limit * 1.15
+--source include/assert.inc
+
+# unlock the table and let SQL thread continue applying events
+UNLOCK TABLES;
+
+--connection master
+--sync_slave_with_master
+--let $diff_tables=master:test.t1,slave:test.t1
+--source include/diff_tables.inc
+
+--connection master
+DROP TABLE t1;
+--enable_query_log
+--sync_slave_with_master
+
+--source include/rpl_end.inc