summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-11-06 16:24:16 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-11-06 16:24:16 +0200
commit074c68409921032f8a64416cc4d5ebc35d95dca9 (patch)
tree615c99d326fd2ce8c0e3b533b40f0e4e3475bbc1 /mysql-test/suite/innodb
parent563efeceece09154f71da6303244b1df36875428 (diff)
parentdf563e0c037f9b2cdb22e145575f92a121b4b529 (diff)
downloadmariadb-git-074c68409921032f8a64416cc4d5ebc35d95dca9.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'mysql-test/suite/innodb')
-rw-r--r--mysql-test/suite/innodb/include/innodb_binlog.combinations3
-rw-r--r--mysql-test/suite/innodb/include/innodb_binlog.inc3
-rw-r--r--mysql-test/suite/innodb/r/alter_inplace_perfschema.result20
-rw-r--r--mysql-test/suite/innodb/r/auto_increment_dup,skip-log-bin.rdiff51
-rw-r--r--mysql-test/suite/innodb/r/auto_increment_dup.result22
-rw-r--r--mysql-test/suite/innodb/r/foreign_key.result59
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter-debug.result18
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter.result140
-rw-r--r--mysql-test/suite/innodb/r/table_flags,32k,debug.rdiff132
-rw-r--r--mysql-test/suite/innodb/r/table_flags,32k,release.rdiff (renamed from mysql-test/suite/innodb/r/table_flags,32k.rdiff)0
-rw-r--r--mysql-test/suite/innodb/r/table_flags,64k,debug.rdiff132
-rw-r--r--mysql-test/suite/innodb/r/table_flags,64k,release.rdiff (renamed from mysql-test/suite/innodb/r/table_flags,64k.rdiff)0
-rw-r--r--mysql-test/suite/innodb/r/table_flags,debug.rdiff122
-rw-r--r--mysql-test/suite/innodb/t/alter_inplace_perfschema.opt2
-rw-r--r--mysql-test/suite/innodb/t/alter_inplace_perfschema.test40
-rw-r--r--mysql-test/suite/innodb/t/auto_increment_dup.test40
-rw-r--r--mysql-test/suite/innodb/t/foreign_key.test94
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-debug.test25
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter.test101
-rw-r--r--mysql-test/suite/innodb/t/table_flags.test5
20 files changed, 945 insertions, 64 deletions
diff --git a/mysql-test/suite/innodb/include/innodb_binlog.combinations b/mysql-test/suite/innodb/include/innodb_binlog.combinations
new file mode 100644
index 00000000000..46d31e733b1
--- /dev/null
+++ b/mysql-test/suite/innodb/include/innodb_binlog.combinations
@@ -0,0 +1,3 @@
+[log-bin]
+log-bin
+[skip-log-bin]
diff --git a/mysql-test/suite/innodb/include/innodb_binlog.inc b/mysql-test/suite/innodb/include/innodb_binlog.inc
new file mode 100644
index 00000000000..3f6ece2422e
--- /dev/null
+++ b/mysql-test/suite/innodb/include/innodb_binlog.inc
@@ -0,0 +1,3 @@
+# See innodb_binlog.combinations
+# --log-bin is ignored in the embedded server
+--source include/not_embedded.inc
diff --git a/mysql-test/suite/innodb/r/alter_inplace_perfschema.result b/mysql-test/suite/innodb/r/alter_inplace_perfschema.result
new file mode 100644
index 00000000000..68e25664031
--- /dev/null
+++ b/mysql-test/suite/innodb/r/alter_inplace_perfschema.result
@@ -0,0 +1,20 @@
+connect ddl, localhost, root,,;
+update performance_schema.setup_instruments set enabled='yes';
+update performance_schema.setup_consumers set enabled='yes';
+CREATE TABLE t1 (a serial, b varchar(255)) ENGINE=InnoDB;
+BEGIN;
+COMMIT;
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL go WAIT_FOR gone';
+ALTER TABLE t1 ADD INDEX(b), ALGORITHM=INPLACE;
+connection default;
+SET DEBUG_SYNC = 'now WAIT_FOR go';
+SELECT DISTINCT object_name FROM performance_schema.events_waits_history_long
+WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
+object_name
+tmp/Innodb Merge Temp File
+SET DEBUG_SYNC = 'now SIGNAL gone';
+connection ddl;
+disconnect ddl;
+connection default;
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/auto_increment_dup,skip-log-bin.rdiff b/mysql-test/suite/innodb/r/auto_increment_dup,skip-log-bin.rdiff
new file mode 100644
index 00000000000..7b4ec54eed8
--- /dev/null
+++ b/mysql-test/suite/innodb/r/auto_increment_dup,skip-log-bin.rdiff
@@ -0,0 +1,51 @@
+--- auto_increment_dup.result
++++ auto_increment_dup,skip-log-bin.reject
+@@ -89,13 +89,14 @@
+ SET DEBUG_SYNC='execute_command_after_close_tables SIGNAL continue';
+ affected rows: 0
+ INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
+-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
++affected rows: 3
++info: Records: 3 Duplicates: 0 Warnings: 0
+ connection con1;
+ #
+ # 2 duplicates
+ #
+-affected rows: 3
+-info: Records: 3 Duplicates: 0 Warnings: 0
++affected rows: 4
++info: Records: 3 Duplicates: 1 Warnings: 0
+ connection default;
+ #
+ # 3 rows
+@@ -103,19 +104,21 @@
+ SELECT * FROM t1 order by k;
+ id k c
+ 1 1 NULL
+-2 2 NULL
+-3 3 NULL
+-affected rows: 3
++4 2 1
++2 3 NULL
++5 4 NULL
++6 5 NULL
++affected rows: 5
+ INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
+-affected rows: 4
+-info: Records: 3 Duplicates: 1 Warnings: 0
++affected rows: 6
++info: Records: 3 Duplicates: 3 Warnings: 0
+ SELECT * FROM t1 order by k;
+ id k c
+ 1 1 NULL
+-2 2 2
+-3 3 NULL
+-7 4 NULL
+-8 5 NULL
++4 2 2
++2 3 NULL
++5 4 2
++6 5 2
+ affected rows: 5
+ disconnect con1;
+ disconnect con2;
diff --git a/mysql-test/suite/innodb/r/auto_increment_dup.result b/mysql-test/suite/innodb/r/auto_increment_dup.result
index fa0921b57a5..1467a459fc1 100644
--- a/mysql-test/suite/innodb/r/auto_increment_dup.result
+++ b/mysql-test/suite/innodb/r/auto_increment_dup.result
@@ -1,4 +1,3 @@
-drop table if exists t1;
set global transaction isolation level repeatable read;
CREATE TABLE t1(
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
@@ -79,20 +78,13 @@ affected rows: 0
#
# Parallel execution
#
-connect con1, localhost, root;
connect con2, localhost, root;
SET DEBUG_SYNC='now WAIT_FOR write_row_done';
-connection con1;
-#
-# Connection 1
-#
+connect con1, localhost, root;
SET DEBUG_SYNC='ha_write_row_end SIGNAL write_row_done WAIT_FOR continue';
affected rows: 0
INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1';
connection con2;
-#
-# Connection 2
-#
affected rows: 0
SET DEBUG_SYNC='execute_command_after_close_tables SIGNAL continue';
affected rows: 0
@@ -140,18 +132,10 @@ k INT,
c CHAR(1),
UNIQUE KEY(k)) ENGINE=InnoDB;
connect con1, localhost, root;
-connect con2, localhost, root;
-connection con1;
-#
-# Connection 1
-#
SET DEBUG_SYNC='ha_write_row_end SIGNAL continue2 WAIT_FOR continue1';
affected rows: 0
INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1';
-connection con2;
-#
-# Connection 2
-#
+connect con2, localhost, root;
SET DEBUG_SYNC='ha_write_row_start WAIT_FOR continue2';
affected rows: 0
SET DEBUG_SYNC='after_mysql_insert SIGNAL continue1';
@@ -159,6 +143,7 @@ affected rows: 0
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
+disconnect con2;
connection con1;
affected rows: 4
info: Records: 3 Duplicates: 1 Warnings: 0
@@ -174,7 +159,6 @@ id k c
5 4 NULL
6 5 NULL
disconnect con1;
-disconnect con2;
connection default;
DROP TABLE t1;
set global transaction isolation level repeatable read;
diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result
index a151651b594..7195f3e7c3f 100644
--- a/mysql-test/suite/innodb/r/foreign_key.result
+++ b/mysql-test/suite/innodb/r/foreign_key.result
@@ -171,6 +171,43 @@ UNLOCK TABLES;
DROP TABLES staff, store;
SET FOREIGN_KEY_CHECKS=1;
#
+# MDEV-17531 Crash in RENAME TABLE with FOREIGN KEY and FULLTEXT INDEX
+#
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE DATABASE best;
+CREATE TABLE t3 (a INT PRIMARY KEY,
+CONSTRAINT t2_ibfk_1 FOREIGN KEY (a) REFERENCES t1(a)) ENGINE=InnoDB;
+CREATE TABLE best.t2 (a INT PRIMARY KEY, b TEXT, FULLTEXT INDEX(b),
+FOREIGN KEY (a) REFERENCES test.t1(a)) ENGINE=InnoDB;
+RENAME TABLE best.t2 TO test.t2;
+ERROR 42S01: Table 't2' already exists
+SHOW CREATE TABLE best.t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL,
+ `b` text DEFAULT NULL,
+ PRIMARY KEY (`a`),
+ FULLTEXT KEY `b` (`b`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t1` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP DATABASE best;
+#
+# MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check hangs
+#
+connect fk, localhost, root,,;
+INSERT INTO t1 SET a=1;
+BEGIN;
+DELETE FROM t1;
+connection default;
+INSERT INTO t3 SET a=1;
+connection fk;
+kill query @id;
+connection default;
+ERROR 70100: Query execution was interrupted
+disconnect fk;
+DROP TABLE t3,t1;
+# Start of 10.2 tests
+#
# MDEV-13246 Stale rows despite ON DELETE CASCADE constraint
#
CREATE TABLE users (
@@ -252,7 +289,6 @@ DELETE FROM t1 WHERE id = 1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection con1;
COMMIT;
-disconnect con1;
connection default;
SELECT * FROM t2;
id ref_id f
@@ -332,7 +368,26 @@ PRIMARY KEY (store_id),
UNIQUE KEY idx_unique_manager (manager_staff_id),
CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE=InnoDB;
-SET FOREIGN_KEY_CHECKS=DEFAULT;
LOCK TABLE staff WRITE;
UNLOCK TABLES;
DROP TABLES staff, store;
+SET FOREIGN_KEY_CHECKS=1;
+#
+# MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check hangs
+#
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT PRIMARY KEY, FOREIGN KEY (a) REFERENCES t1(a))
+ENGINE=InnoDB;
+connection con1;
+INSERT INTO t1 SET a=1;
+BEGIN;
+DELETE FROM t1;
+connection default;
+INSERT INTO t2 SET a=1;
+connection con1;
+kill query @id;
+connection default;
+ERROR 70100: Query execution was interrupted
+disconnect con1;
+DROP TABLE t2,t1;
+# End of 10.2 tests
diff --git a/mysql-test/suite/innodb/r/innodb-alter-debug.result b/mysql-test/suite/innodb/r/innodb-alter-debug.result
index d455e54be3d..73037247272 100644
--- a/mysql-test/suite/innodb/r/innodb-alter-debug.result
+++ b/mysql-test/suite/innodb/r/innodb-alter-debug.result
@@ -52,10 +52,26 @@ set DEBUG_SYNC = 'now WAIT_FOR s1';
update t1 set a=1 where id=2;
ERROR 23000: Duplicate entry '1' for key 'uk'
SET DEBUG_SYNC = 'now SIGNAL s2';
-disconnect con1;
/* connection default */
connection default;
/* reap */ alter table t1 force, add b int, ALGORITHM=inplace;
ERROR 23000: Duplicate entry '1' for key 'uk'
SET DEBUG_SYNC = 'RESET';
drop table t1;
+#
+# Bug #27753193 ASSERTION `PREBUILT->TRX->ERROR_KEY_NUM <
+# HA_ALTER_INFO->KEY_COUNT'
+CREATE TABLE t1 (a INT, UNIQUE KEY(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET DEBUG_SYNC = 'row_log_table_apply1_before signal S1 WAIT_FOR S2';
+ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
+connection con1;
+SET DEBUG_SYNC = 'now WAIT_FOR S1';
+INSERT INTO t1 VALUES (1);
+ERROR 23000: Duplicate entry '1' for key 'a'
+SET DEBUG_SYNC = 'now SIGNAL S2';
+disconnect con1;
+connection default;
+ERROR 23000: Duplicate entry '1' for key 'a'
+SET DEBUG_SYNC='RESET';
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-alter.result b/mysql-test/suite/innodb/r/innodb-alter.result
index 8f8a30d832d..7b0a43297e0 100644
--- a/mysql-test/suite/innodb/r/innodb-alter.result
+++ b/mysql-test/suite/innodb/r/innodb-alter.result
@@ -728,6 +728,7 @@ t2 CREATE TABLE `t2` (
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE t1 CHANGE COLUMN c1 C1 INT;
+ALTER TABLE t2 CHANGE COLUMN c2 C2 INT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -737,24 +738,149 @@ t1 CREATE TABLE `t1` (
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `c2` int(11) NOT NULL,
- KEY `c2` (`c2`),
+ `C2` int(11) DEFAULT NULL,
+ KEY `c2` (`C2`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ALTER TABLE t1 CHANGE COLUMN C1 c5 INT;
+ALTER TABLE t2 CHANGE COLUMN C2 c6 INT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `C1` int(11) NOT NULL,
- PRIMARY KEY (`C1`)
+ `c5` int(11) NOT NULL,
+ PRIMARY KEY (`c5`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `c2` int(11) NOT NULL,
- KEY `c2` (`c2`),
- CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
+ `c6` int(11) DEFAULT NULL,
+ KEY `c2` (`c6`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c6`) REFERENCES `t1` (`c5`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
+INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
+WHERE T.NAME='test/t1';
+NAME
+c5
+SELECT F.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS F INNER JOIN
+INFORMATION_SCHEMA.INNODB_SYS_INDEXES I ON F.INDEX_ID=I.INDEX_ID INNER JOIN
+INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON I.TABLE_ID=T.TABLE_ID
+WHERE T.NAME='test/t1' AND I.NAME='PRIMARY';
+NAME
+c5
+SELECT C.REF_COL_NAME, C.FOR_COL_NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS C INNER JOIN
+INFORMATION_SCHEMA.INNODB_SYS_FOREIGN F ON C.ID=F.ID
+WHERE F.FOR_NAME='test/t2';
+REF_COL_NAME FOR_COL_NAME
+c5 c6
DROP TABLE t2, t1;
+# virtual columns case too
+CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a) VIRTUAL) ENGINE = InnoDB;
+ALTER TABLE t1 CHANGE COLUMN a A INT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `A` int(11) DEFAULT NULL,
+ `b` int(11) GENERATED ALWAYS AS (`A`) VIRTUAL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
+INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
+WHERE T.NAME='test/t1';
+NAME
+a
+b
+DROP TABLE t1;
+# different FOREIGN KEY cases
+CREATE TABLE t1 (
+a INT UNIQUE KEY,
+b INT UNIQUE KEY,
+c INT UNIQUE KEY,
+d INT UNIQUE KEY
+) ENGINE=INNODB;
+CREATE TABLE t2 (
+aa INT,
+bb INT,
+cc INT,
+dd INT
+) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1, 1, 1, 1);
+INSERT INTO t2 VALUES (1, 1, 1, 1);
+ALTER TABLE t1 CHANGE a A INT, ALGORITHM=INPLACE;
+ALTER TABLE t1 CHANGE c C INT, ALGORITHM=INPLACE;
+ALTER TABLE t2 CHANGE cc CC INT, ALGORITHM=INPLACE;
+ALTER TABLE t2 CHANGE dd DD INT, ALGORITHM=INPLACE;
+SET foreign_key_checks=0;
+ALTER TABLE t2
+ADD FOREIGN KEY(aa) REFERENCES t1(a),
+ADD FOREIGN KEY(bb) REFERENCES t1(b),
+ADD FOREIGN KEY(cc) REFERENCES t1(c),
+ADD FOREIGN KEY(dd) REFERENCES t1(d),
+ALGORITHM=INPLACE;
+ALTER TABLE t1 CHANGE b B INT, ALGORITHM=INPLACE;
+ALTER TABLE t2 CHANGE aa AA INT, ALGORITHM=INPLACE;
+ALTER TABLE t1 CHANGE d D INT, ALGORITHM=INPLACE;
+ALTER TABLE t2 CHANGE bb BB INT, ALGORITHM=INPLACE;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `A` int(11) DEFAULT NULL,
+ `B` int(11) DEFAULT NULL,
+ `C` int(11) DEFAULT NULL,
+ `D` int(11) DEFAULT NULL,
+ UNIQUE KEY `a` (`A`),
+ UNIQUE KEY `b` (`B`),
+ UNIQUE KEY `c` (`C`),
+ UNIQUE KEY `d` (`D`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `AA` int(11) DEFAULT NULL,
+ `BB` int(11) DEFAULT NULL,
+ `CC` int(11) DEFAULT NULL,
+ `DD` int(11) DEFAULT NULL,
+ KEY `aa` (`AA`),
+ KEY `bb` (`BB`),
+ KEY `CC` (`CC`),
+ KEY `DD` (`DD`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`),
+ CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`bb`) REFERENCES `t1` (`b`),
+ CONSTRAINT `t2_ibfk_3` FOREIGN KEY (`cc`) REFERENCES `t1` (`c`),
+ CONSTRAINT `t2_ibfk_4` FOREIGN KEY (`dd`) REFERENCES `t1` (`d`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DELETE FROM t1 WHERE a=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
+DELETE FROM t1 WHERE A=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
+DELETE FROM t1 WHERE b=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
+DELETE FROM t1 WHERE B=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
+DELETE FROM t1 WHERE c=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
+DELETE FROM t1 WHERE C=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
+DELETE FROM t1 WHERE d=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
+DELETE FROM t1 WHERE D=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`aa`) REFERENCES `t1` (`a`))
+DROP TABLE t2, t1;
+# virtual columns case too
+CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a) VIRTUAL) ENGINE = InnoDB;
+ALTER TABLE t1 CHANGE COLUMN a A INT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `A` int(11) DEFAULT NULL,
+ `b` int(11) GENERATED ALWAYS AS (`A`) VIRTUAL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
+INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
+WHERE T.NAME='test/t1';
+NAME
+a
+b
+DROP TABLE t1;
#
# BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN
# DICT_MEM_TABLE_COL_RENAME_LOW
diff --git a/mysql-test/suite/innodb/r/table_flags,32k,debug.rdiff b/mysql-test/suite/innodb/r/table_flags,32k,debug.rdiff
new file mode 100644
index 00000000000..7e851cf5634
--- /dev/null
+++ b/mysql-test/suite/innodb/r/table_flags,32k,debug.rdiff
@@ -0,0 +1,132 @@
+--- suite/innodb/r/table_flags.result
++++ suite/innodb/r/table_flags,32k,debug.reject
+@@ -5,96 +5,98 @@
+ SET innodb_strict_mode=OFF;
+ CREATE TABLE tz(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=COMPRESSED
+ KEY_BLOCK_SIZE=1;
++Warnings:
++Warning 1478 InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. Assuming ROW_FORMAT=DYNAMIC.
+ SET innodb_strict_mode=ON;
+ CREATE TABLE tp(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC
+ PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
+ SYS_TABLES clustered index root page (8):
+ N_RECS=10; LEVEL=0; INDEX_ID=0x0000000000000001
+-header=0x01000003016e (NAME=0x696e66696d756d00)
+-header=0x00002815008d (NAME='SYS_DATAFILES',
++header=0x0100000301bf (NAME=0x696e66696d756d00)
++header=0x0000301500de (NAME='SYS_DATAFILES',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x000000000000000e,
++ ID=0x000000000000000f,
+ N_COLS=0x00000002,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+-header=0x0000101500d5 (NAME='SYS_FOREIGN',
++header=0x000018150126 (NAME='SYS_FOREIGN',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x000000000000000b,
++ ID=0x000000000000000c,
+ N_COLS=0x00000004,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+-header=0x000018150122 (NAME='SYS_FOREIGN_COLS',
++header=0x000020150173 (NAME='SYS_FOREIGN_COLS',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x000000000000000c,
++ ID=0x000000000000000d,
+ N_COLS=0x00000004,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+-header=0x0400201501b8 (NAME='SYS_TABLESPACES',
++header=0x040028150209 (NAME='SYS_TABLESPACES',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x000000000000000d,
++ ID=0x000000000000000e,
+ N_COLS=0x00000003,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+-header=0x000030150244 (NAME='SYS_VIRTUAL',
++header=0x000038150251 (NAME='SYS_VIRTUAL',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x000000000000000f,
++ ID=0x0000000000000010,
+ N_COLS=0x00000003,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+-header=0x000040150288 (NAME='test/tc',
++header=0x000040150295 (NAME='test/tc',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x0000000000000011,
++ ID=0x0000000000000012,
+ N_COLS=0x80000001,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000002)
+-header=0x000048150310 (NAME='test/td',
++header=0x00004815031d (NAME='test/td',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x0000000000000012,
++ ID=0x0000000000000013,
+ N_COLS=0x80000001,
+ TYPE=0x00000021,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000003)
+-header=0x000058150200 (NAME='test/tp',
++header=0x00005815008d (NAME='test/tp',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x0000000000000014,
++ ID=0x0000000000000015,
+ N_COLS=0x80000001,
+ TYPE=0x000009a1,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000005)
+-header=0x0000381502cc (NAME='test/tr',
++header=0x0000101502d9 (NAME='test/tr',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x0000000000000010,
++ ID=0x0000000000000011,
+ N_COLS=0x00000001,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+@@ -104,9 +106,9 @@
+ header=0x000050150074 (NAME='test/tz',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x0000000000000013,
++ ID=0x0000000000000014,
+ N_COLS=0x80000001,
+- TYPE=0x00000023,
++ TYPE=0x00000021,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
diff --git a/mysql-test/suite/innodb/r/table_flags,32k.rdiff b/mysql-test/suite/innodb/r/table_flags,32k,release.rdiff
index ce1ff623d50..ce1ff623d50 100644
--- a/mysql-test/suite/innodb/r/table_flags,32k.rdiff
+++ b/mysql-test/suite/innodb/r/table_flags,32k,release.rdiff
diff --git a/mysql-test/suite/innodb/r/table_flags,64k,debug.rdiff b/mysql-test/suite/innodb/r/table_flags,64k,debug.rdiff
new file mode 100644
index 00000000000..da52f17fa68
--- /dev/null
+++ b/mysql-test/suite/innodb/r/table_flags,64k,debug.rdiff
@@ -0,0 +1,132 @@
+--- suite/innodb/r/table_flags.result
++++ suite/innodb/r/table_flags,64k,debug.reject
+@@ -5,96 +5,98 @@
+ SET innodb_strict_mode=OFF;
+ CREATE TABLE tz(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=COMPRESSED
+ KEY_BLOCK_SIZE=1;
++Warnings:
++Warning 1478 InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. Assuming ROW_FORMAT=DYNAMIC.
+ SET innodb_strict_mode=ON;
+ CREATE TABLE tp(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC
+ PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
+ SYS_TABLES clustered index root page (8):
+ N_RECS=10; LEVEL=0; INDEX_ID=0x0000000000000001
+-header=0x01000003016e (NAME=0x696e66696d756d00)
+-header=0x00002815008d (NAME='SYS_DATAFILES',
++header=0x0100000301bf (NAME=0x696e66696d756d00)
++header=0x0000301500de (NAME='SYS_DATAFILES',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x000000000000000e,
++ ID=0x000000000000000f,
+ N_COLS=0x00000002,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+-header=0x0000101500d5 (NAME='SYS_FOREIGN',
++header=0x000018150126 (NAME='SYS_FOREIGN',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x000000000000000b,
++ ID=0x000000000000000c,
+ N_COLS=0x00000004,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+-header=0x000018150122 (NAME='SYS_FOREIGN_COLS',
++header=0x000020150173 (NAME='SYS_FOREIGN_COLS',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x000000000000000c,
++ ID=0x000000000000000d,
+ N_COLS=0x00000004,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+-header=0x0400201501b8 (NAME='SYS_TABLESPACES',
++header=0x040028150209 (NAME='SYS_TABLESPACES',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x000000000000000d,
++ ID=0x000000000000000e,
+ N_COLS=0x00000003,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+-header=0x000030150244 (NAME='SYS_VIRTUAL',
++header=0x000038150251 (NAME='SYS_VIRTUAL',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x000000000000000f,
++ ID=0x0000000000000010,
+ N_COLS=0x00000003,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+-header=0x000040150288 (NAME='test/tc',
++header=0x000040150295 (NAME='test/tc',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x0000000000000011,
++ ID=0x0000000000000012,
+ N_COLS=0x80000001,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000002)
+-header=0x000048150310 (NAME='test/td',
++header=0x00004815031d (NAME='test/td',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x0000000000000012,
++ ID=0x0000000000000013,
+ N_COLS=0x80000001,
+ TYPE=0x00000021,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000003)
+-header=0x000058150200 (NAME='test/tp',
++header=0x00005815008d (NAME='test/tp',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x0000000000000014,
++ ID=0x0000000000000015,
+ N_COLS=0x80000001,
+ TYPE=0x000009a1,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000005)
+-header=0x0000381502cc (NAME='test/tr',
++header=0x0000101502d9 (NAME='test/tr',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x0000000000000010,
++ ID=0x0000000000000011,
+ N_COLS=0x00000001,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+@@ -104,9 +106,9 @@
+ header=0x000050150074 (NAME='test/tz',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x0000000000000013,
++ ID=0x0000000000000014,
+ N_COLS=0x80000001,
+- TYPE=0x00000023,
++ TYPE=0x00000021,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
diff --git a/mysql-test/suite/innodb/r/table_flags,64k.rdiff b/mysql-test/suite/innodb/r/table_flags,64k,release.rdiff
index f2ba1280be3..f2ba1280be3 100644
--- a/mysql-test/suite/innodb/r/table_flags,64k.rdiff
+++ b/mysql-test/suite/innodb/r/table_flags,64k,release.rdiff
diff --git a/mysql-test/suite/innodb/r/table_flags,debug.rdiff b/mysql-test/suite/innodb/r/table_flags,debug.rdiff
new file mode 100644
index 00000000000..16f748468dd
--- /dev/null
+++ b/mysql-test/suite/innodb/r/table_flags,debug.rdiff
@@ -0,0 +1,122 @@
+--- suite/innodb/r/table_flags.result
++++ suite/innodb/r/table_flags,debug.reject
+@@ -10,91 +10,91 @@
+ PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
+ SYS_TABLES clustered index root page (8):
+ N_RECS=10; LEVEL=0; INDEX_ID=0x0000000000000001
+-header=0x01000003016e (NAME=0x696e66696d756d00)
+-header=0x00002815008d (NAME='SYS_DATAFILES',
++header=0x0100000301bf (NAME=0x696e66696d756d00)
++header=0x0000301500de (NAME='SYS_DATAFILES',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x000000000000000e,
++ ID=0x000000000000000f,
+ N_COLS=0x00000002,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+-header=0x0000101500d5 (NAME='SYS_FOREIGN',
++header=0x000018150126 (NAME='SYS_FOREIGN',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x000000000000000b,
++ ID=0x000000000000000c,
+ N_COLS=0x00000004,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+-header=0x000018150122 (NAME='SYS_FOREIGN_COLS',
++header=0x000020150173 (NAME='SYS_FOREIGN_COLS',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x000000000000000c,
++ ID=0x000000000000000d,
+ N_COLS=0x00000004,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+-header=0x0400201501b8 (NAME='SYS_TABLESPACES',
++header=0x040028150209 (NAME='SYS_TABLESPACES',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x000000000000000d,
++ ID=0x000000000000000e,
+ N_COLS=0x00000003,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+-header=0x000030150244 (NAME='SYS_VIRTUAL',
++header=0x000038150251 (NAME='SYS_VIRTUAL',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x000000000000000f,
++ ID=0x0000000000000010,
+ N_COLS=0x00000003,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+-header=0x000040150288 (NAME='test/tc',
++header=0x000040150295 (NAME='test/tc',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x0000000000000011,
++ ID=0x0000000000000012,
+ N_COLS=0x80000001,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000002)
+-header=0x000048150310 (NAME='test/td',
++header=0x00004815031d (NAME='test/td',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x0000000000000012,
++ ID=0x0000000000000013,
+ N_COLS=0x80000001,
+ TYPE=0x00000021,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000003)
+-header=0x000058150200 (NAME='test/tp',
++header=0x00005815008d (NAME='test/tp',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x0000000000000014,
++ ID=0x0000000000000015,
+ N_COLS=0x80000001,
+ TYPE=0x000009a1,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000005)
+-header=0x0000381502cc (NAME='test/tr',
++header=0x0000101502d9 (NAME='test/tr',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x0000000000000010,
++ ID=0x0000000000000011,
+ N_COLS=0x00000001,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+@@ -104,7 +104,7 @@
+ header=0x000050150074 (NAME='test/tz',
+ DB_TRX_ID=0x000000000000,
+ DB_ROLL_PTR=0x80000000000000,
+- ID=0x0000000000000013,
++ ID=0x0000000000000014,
+ N_COLS=0x80000001,
+ TYPE=0x00000023,
+ MIX_ID=0x0000000000000000,
diff --git a/mysql-test/suite/innodb/t/alter_inplace_perfschema.opt b/mysql-test/suite/innodb/t/alter_inplace_perfschema.opt
new file mode 100644
index 00000000000..f56125521fc
--- /dev/null
+++ b/mysql-test/suite/innodb/t/alter_inplace_perfschema.opt
@@ -0,0 +1,2 @@
+--innodb-sort-buffer-size=64k
+--tmpdir=$MYSQLTEST_VARDIR/tmp
diff --git a/mysql-test/suite/innodb/t/alter_inplace_perfschema.test b/mysql-test/suite/innodb/t/alter_inplace_perfschema.test
new file mode 100644
index 00000000000..b832596647f
--- /dev/null
+++ b/mysql-test/suite/innodb/t/alter_inplace_perfschema.test
@@ -0,0 +1,40 @@
+--source include/have_innodb.inc
+--source include/have_perfschema.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/not_embedded.inc
+
+connect (ddl, localhost, root,,);
+update performance_schema.setup_instruments set enabled='yes';
+update performance_schema.setup_consumers set enabled='yes';
+CREATE TABLE t1 (a serial, b varchar(255)) ENGINE=InnoDB;
+
+BEGIN;
+let $n=247;
+--disable_query_log
+while ($n) {
+dec $n;
+INSERT INTO t1 SELECT NULL, REPEAT('b',255);
+}
+--enable_query_log
+COMMIT;
+
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL go WAIT_FOR gone';
+send ALTER TABLE t1 ADD INDEX(b), ALGORITHM=INPLACE;
+
+connection default;
+SET DEBUG_SYNC = 'now WAIT_FOR go';
+--replace_regex /.*[\\\/]tmp/tmp/
+SELECT DISTINCT object_name FROM performance_schema.events_waits_history_long
+WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
+
+#--exec lsof -p `pidof mysqld`
+SET DEBUG_SYNC = 'now SIGNAL gone';
+
+connection ddl;
+reap;
+disconnect ddl;
+
+connection default;
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/auto_increment_dup.test b/mysql-test/suite/innodb/t/auto_increment_dup.test
index 45e4559a038..aa399e5966d 100644
--- a/mysql-test/suite/innodb/t/auto_increment_dup.test
+++ b/mysql-test/suite/innodb/t/auto_increment_dup.test
@@ -4,11 +4,11 @@
##########################################################################
--source include/have_innodb.inc
+--source include/have_debug.inc
--source include/have_debug_sync.inc
+--source include/innodb_binlog.inc
---disable_warnings
-drop table if exists t1;
---enable_warnings
+let $stmt= `SELECT @@GLOBAL.log_bin`;
set global transaction isolation level repeatable read;
@@ -69,29 +69,28 @@ CREATE TABLE t1(
k INT,
c CHAR(1),
UNIQUE KEY(k)) ENGINE=InnoDB;
-
+
--echo #
--echo # Parallel execution
--echo #
---connect(con1, localhost, root)
--connect(con2, localhost, root)
-
--send SET DEBUG_SYNC='now WAIT_FOR write_row_done'
---connection con1
---echo #
---echo # Connection 1
---echo #
+
+--connect(con1, localhost, root)
SET DEBUG_SYNC='ha_write_row_end SIGNAL write_row_done WAIT_FOR continue';
--send INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1'
--connection con2
---echo #
---echo # Connection 2
---echo #
--reap
+
SET DEBUG_SYNC='execute_command_after_close_tables SIGNAL continue';
+if ($stmt) {
--error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
+}
+if (!$stmt) {
+INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
+}
--connection con1
--echo #
@@ -138,23 +137,14 @@ CREATE TABLE t1(
--enable_info
--connect(con1, localhost, root)
---connect(con2, localhost, root)
-
---connection con1
-
---echo #
---echo # Connection 1
---echo #
SET DEBUG_SYNC='ha_write_row_end SIGNAL continue2 WAIT_FOR continue1';
--send INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1'
---connection con2
---echo #
---echo # Connection 2
---echo #
+--connect(con2, localhost, root)
SET DEBUG_SYNC='ha_write_row_start WAIT_FOR continue2';
SET DEBUG_SYNC='after_mysql_insert SIGNAL continue1';
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
+--disconnect con2
--connection con1
--reap
@@ -167,11 +157,9 @@ SET DEBUG_SYNC='RESET';
SELECT * FROM t1 ORDER BY k;
--disconnect con1
---disconnect con2
--connection default
DROP TABLE t1;
set global transaction isolation level repeatable read;
-
diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test
index 7a8a9295ee7..6e8658c4e3e 100644
--- a/mysql-test/suite/innodb/t/foreign_key.test
+++ b/mysql-test/suite/innodb/t/foreign_key.test
@@ -138,9 +138,62 @@ SET FOREIGN_KEY_CHECKS=DEFAULT;
LOCK TABLE staff WRITE;
UNLOCK TABLES;
DROP TABLES staff, store;
+
SET FOREIGN_KEY_CHECKS=1;
--echo #
+--echo # MDEV-17531 Crash in RENAME TABLE with FOREIGN KEY and FULLTEXT INDEX
+--echo #
+
+--disable_query_log
+call mtr.add_suppression("InnoDB: Possible reasons:");
+call mtr.add_suppression("InnoDB: \\([12]\\) Table ");
+call mtr.add_suppression("InnoDB: If table `test`\\.`t2` is a temporary table");
+--enable_query_log
+
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE DATABASE best;
+CREATE TABLE t3 (a INT PRIMARY KEY,
+CONSTRAINT t2_ibfk_1 FOREIGN KEY (a) REFERENCES t1(a)) ENGINE=InnoDB;
+CREATE TABLE best.t2 (a INT PRIMARY KEY, b TEXT, FULLTEXT INDEX(b),
+FOREIGN KEY (a) REFERENCES test.t1(a)) ENGINE=InnoDB;
+--replace_regex /Table '.*t2'/Table 't2'/
+--error ER_TABLE_EXISTS_ERROR
+RENAME TABLE best.t2 TO test.t2;
+SHOW CREATE TABLE best.t2;
+DROP DATABASE best;
+
+--echo #
+--echo # MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check hangs
+--echo #
+connect (fk, localhost, root,,);
+INSERT INTO t1 SET a=1;
+BEGIN;
+DELETE FROM t1;
+
+connection default;
+let $ID= `SELECT @id := CONNECTION_ID()`;
+send INSERT INTO t3 SET a=1;
+
+connection fk;
+# Check that the above SELECT is blocked
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = 'update' and info = 'INSERT INTO t3 SET a=1';
+--source include/wait_condition.inc
+let $ignore= `SELECT @id := $ID`;
+kill query @id;
+
+connection default;
+--error ER_QUERY_INTERRUPTED
+reap;
+disconnect fk;
+
+DROP TABLE t3,t1;
+
+--echo # Start of 10.2 tests
+
+--echo #
--echo # MDEV-13246 Stale rows despite ON DELETE CASCADE constraint
--echo #
@@ -228,7 +281,6 @@ DELETE FROM t1 WHERE id = 1;
--connection con1
COMMIT;
---disconnect con1
--connection default
SELECT * FROM t2;
@@ -288,8 +340,6 @@ insert into t1 values(1, 1);
insert into t2(f1) values(1);
drop table t2, t1;
---source include/wait_until_count_sessions.inc
-
#
# MDEV-12669 Circular foreign keys cause a loop and OOM upon LOCK TABLE
#
@@ -308,8 +358,44 @@ CREATE TABLE store (
UNIQUE KEY idx_unique_manager (manager_staff_id),
CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE=InnoDB;
-SET FOREIGN_KEY_CHECKS=DEFAULT;
LOCK TABLE staff WRITE;
UNLOCK TABLES;
DROP TABLES staff, store;
+SET FOREIGN_KEY_CHECKS=1;
+
+--echo #
+--echo # MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check hangs
+--echo #
+
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT PRIMARY KEY, FOREIGN KEY (a) REFERENCES t1(a))
+ENGINE=InnoDB;
+
+connection con1;
+INSERT INTO t1 SET a=1;
+BEGIN;
+DELETE FROM t1;
+
+connection default;
+let $ID= `SELECT @id := CONNECTION_ID()`;
+send INSERT INTO t2 SET a=1;
+
+connection con1;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = 'update' and info = 'INSERT INTO t2 SET a=1';
+--source include/wait_condition.inc
+let $ignore= `SELECT @id := $ID`;
+kill query @id;
+
+connection default;
+--error ER_QUERY_INTERRUPTED
+reap;
+disconnect con1;
+
+DROP TABLE t2,t1;
+
+--echo # End of 10.2 tests
+
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb/t/innodb-alter-debug.test b/mysql-test/suite/innodb/t/innodb-alter-debug.test
index a779aecb71f..5c8025265e5 100644
--- a/mysql-test/suite/innodb/t/innodb-alter-debug.test
+++ b/mysql-test/suite/innodb/t/innodb-alter-debug.test
@@ -64,7 +64,6 @@ set DEBUG_SYNC = 'now WAIT_FOR s1';
--error ER_DUP_ENTRY
update t1 set a=1 where id=2;
SET DEBUG_SYNC = 'now SIGNAL s2';
-disconnect con1;
--echo /* connection default */
connection default;
@@ -75,5 +74,29 @@ SET DEBUG_SYNC = 'RESET';
drop table t1;
+--echo #
+--echo # Bug #27753193 ASSERTION `PREBUILT->TRX->ERROR_KEY_NUM <
+--echo # HA_ALTER_INFO->KEY_COUNT'
+
+CREATE TABLE t1 (a INT, UNIQUE KEY(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+SET DEBUG_SYNC = 'row_log_table_apply1_before signal S1 WAIT_FOR S2';
+send ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
+
+connection con1;
+SET DEBUG_SYNC = 'now WAIT_FOR S1';
+--error ER_DUP_ENTRY
+INSERT INTO t1 VALUES (1);
+SET DEBUG_SYNC = 'now SIGNAL S2';
+disconnect con1;
+
+CONNECTION default;
+--error ER_DUP_ENTRY
+reap;
+SET DEBUG_SYNC='RESET';
+
+DROP TABLE t1;
+
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb/t/innodb-alter.test b/mysql-test/suite/innodb/t/innodb-alter.test
index 4f2ea5f3540..a7f1eb56dce 100644
--- a/mysql-test/suite/innodb/t/innodb-alter.test
+++ b/mysql-test/suite/innodb/t/innodb-alter.test
@@ -442,15 +442,110 @@ CREATE TABLE t2(c2 INT NOT NULL, FOREIGN KEY(c2) REFERENCES t1(c1))ENGINE=INNODB
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
ALTER TABLE t1 CHANGE COLUMN c1 C1 INT;
+ALTER TABLE t2 CHANGE COLUMN c2 C2 INT;
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
-# FIXME: MDEV-13671 InnoDB should use case-insensitive column name comparisons
-# like the rest of the server
-#ALTER TABLE t1 CHANGE COLUMN C1 c5 INT;
+ALTER TABLE t1 CHANGE COLUMN C1 c5 INT;
+ALTER TABLE t2 CHANGE COLUMN C2 c6 INT;
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
+
+SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
+ INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
+ WHERE T.NAME='test/t1';
+
+SELECT F.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS F INNER JOIN
+ INFORMATION_SCHEMA.INNODB_SYS_INDEXES I ON F.INDEX_ID=I.INDEX_ID INNER JOIN
+ INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON I.TABLE_ID=T.TABLE_ID
+ WHERE T.NAME='test/t1' AND I.NAME='PRIMARY';
+
+SELECT C.REF_COL_NAME, C.FOR_COL_NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS C INNER JOIN
+ INFORMATION_SCHEMA.INNODB_SYS_FOREIGN F ON C.ID=F.ID
+ WHERE F.FOR_NAME='test/t2';
+
+DROP TABLE t2, t1;
+--echo # virtual columns case too
+CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a) VIRTUAL) ENGINE = InnoDB;
+ALTER TABLE t1 CHANGE COLUMN a A INT;
+SHOW CREATE TABLE t1;
+SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
+ INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
+ WHERE T.NAME='test/t1';
+DROP TABLE t1;
+
+
+--echo # different FOREIGN KEY cases
+CREATE TABLE t1 (
+ a INT UNIQUE KEY,
+ b INT UNIQUE KEY,
+ c INT UNIQUE KEY,
+ d INT UNIQUE KEY
+) ENGINE=INNODB;
+CREATE TABLE t2 (
+ aa INT,
+ bb INT,
+ cc INT,
+ dd INT
+) ENGINE=INNODB;
+
+INSERT INTO t1 VALUES (1, 1, 1, 1);
+INSERT INTO t2 VALUES (1, 1, 1, 1);
+
+ALTER TABLE t1 CHANGE a A INT, ALGORITHM=INPLACE;
+ALTER TABLE t1 CHANGE c C INT, ALGORITHM=INPLACE;
+ALTER TABLE t2 CHANGE cc CC INT, ALGORITHM=INPLACE;
+ALTER TABLE t2 CHANGE dd DD INT, ALGORITHM=INPLACE;
+
+SET foreign_key_checks=0;
+ALTER TABLE t2
+ ADD FOREIGN KEY(aa) REFERENCES t1(a),
+ ADD FOREIGN KEY(bb) REFERENCES t1(b),
+ ADD FOREIGN KEY(cc) REFERENCES t1(c),
+ ADD FOREIGN KEY(dd) REFERENCES t1(d),
+ ALGORITHM=INPLACE;
+
+ALTER TABLE t1 CHANGE b B INT, ALGORITHM=INPLACE;
+ALTER TABLE t2 CHANGE aa AA INT, ALGORITHM=INPLACE;
+
+--source include/restart_mysqld.inc
+
+ALTER TABLE t1 CHANGE d D INT, ALGORITHM=INPLACE;
+ALTER TABLE t2 CHANGE bb BB INT, ALGORITHM=INPLACE;
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t2;
+
+--error ER_ROW_IS_REFERENCED_2
+DELETE FROM t1 WHERE a=1;
+--error ER_ROW_IS_REFERENCED_2
+DELETE FROM t1 WHERE A=1;
+
+--error ER_ROW_IS_REFERENCED_2
+DELETE FROM t1 WHERE b=1;
+--error ER_ROW_IS_REFERENCED_2
+DELETE FROM t1 WHERE B=1;
+
+--error ER_ROW_IS_REFERENCED_2
+DELETE FROM t1 WHERE c=1;
+--error ER_ROW_IS_REFERENCED_2
+DELETE FROM t1 WHERE C=1;
+
+--error ER_ROW_IS_REFERENCED_2
+DELETE FROM t1 WHERE d=1;
+--error ER_ROW_IS_REFERENCED_2
+DELETE FROM t1 WHERE D=1;
+
DROP TABLE t2, t1;
+--echo # virtual columns case too
+CREATE TABLE t1 (a INT, b INT GENERATED ALWAYS AS (a) VIRTUAL) ENGINE = InnoDB;
+ALTER TABLE t1 CHANGE COLUMN a A INT;
+SHOW CREATE TABLE t1;
+SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN
+ INFORMATION_SCHEMA.INNODB_SYS_TABLES T ON C.TABLE_ID=T.TABLE_ID
+ WHERE T.NAME='test/t1';
+DROP TABLE t1;
+
+
--echo #
--echo # BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN
--echo # DICT_MEM_TABLE_COL_RENAME_LOW
diff --git a/mysql-test/suite/innodb/t/table_flags.test b/mysql-test/suite/innodb/t/table_flags.test
index 6c9b5e7a8cd..284589a17c8 100644
--- a/mysql-test/suite/innodb/t/table_flags.test
+++ b/mysql-test/suite/innodb/t/table_flags.test
@@ -1,6 +1,7 @@
--source include/innodb_page_size.inc
# Embedded server tests do not support restarting
--source include/not_embedded.inc
+--source include/maybe_debug.inc
--disable_query_log
call mtr.add_suppression("InnoDB: Table `mysql`\\.`innodb_table_stats` not found");
@@ -30,7 +31,9 @@ let bugdir= $MYSQLTEST_VARDIR/tmp/table_flags;
--let $d=$d --innodb-undo-tablespaces=0
--let $d=$d --innodb-purge-rseg-truncate-frequency=1
--let $d=$d --skip-innodb-fast-shutdown
-
+if ($have_debug) {
+--let $d=$d --debug=d,create_and_drop_garbage
+}
--let $restart_parameters=$d --innodb-stats-persistent=0
--source include/restart_mysqld.inc