summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2020-05-11 19:09:46 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2020-05-11 19:09:46 +0200
commit23d3d180ca47954c8138fee2a4356e0f7e531fc3 (patch)
treedf1120a8e1c0c41c6a099ad32503e8c4e0f1362e
parenta0778860af564edeca97ed8a7a6e3e8cbad333b4 (diff)
parent530da97c65a8018ef049dfb990df6b98bc5e4ccd (diff)
downloadmariadb-git-23d3d180ca47954c8138fee2a4356e0f7e531fc3.tar.gz
Merge branch '10.1-release' into 10.1
-rw-r--r--CMakeLists.txt5
-rw-r--r--cmake/cpack_rpm.cmake8
-rw-r--r--mysql-test/r/processlist_notembedded.result3
-rw-r--r--mysql-test/suite/innodb/r/foreign-keys.result126
-rw-r--r--mysql-test/suite/innodb/r/foreign_key.result103
-rw-r--r--mysql-test/suite/innodb/r/foreign_key_debug.result60
-rw-r--r--mysql-test/suite/innodb/t/foreign-keys.test160
-rw-r--r--mysql-test/suite/innodb/t/foreign_key.test130
-rw-r--r--mysql-test/suite/innodb/t/foreign_key_debug.test78
-rw-r--r--mysql-test/t/processlist_notembedded.test9
-rw-r--r--mysql-test/unstable-tests90
-rw-r--r--sql/sql_base.cc9
-rw-r--r--sql/table.h3
13 files changed, 436 insertions, 348 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 083fa753b88..05e3c52f1e4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -144,8 +144,6 @@ INCLUDE(mysql_version)
INCLUDE(cpack_source_ignore_files)
INCLUDE(install_layout)
INCLUDE(wsrep)
-INCLUDE(cpack_rpm)
-INCLUDE(cpack_deb)
# Add macros
INCLUDE(character_sets)
@@ -395,6 +393,9 @@ IF(WITH_UNIT_TESTS)
ENDIF()
ENDIF()
+INCLUDE(cpack_rpm)
+INCLUDE(cpack_deb)
+
SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
# Add storage engines and plugins.
CONFIGURE_PLUGINS()
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index ae9e3b904b3..a0449b5918d 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -232,6 +232,14 @@ ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7")
ALTERNATIVE_NAME("shared" "mysql-libs")
ALTERNATIVE_NAME("test" "mariadb-test")
SET(CPACK_RPM_common_PACKAGE_CONFLICTS "mariadb-libs < 1:%{version}-%{release}")
+ELSEIF(RPM MATCHES "sles")
+ ALTERNATIVE_NAME("server" "mariadb")
+ SETA(CPACK_RPM_server_PACKAGE_PROVIDES
+ "mysql = %{version}-%{release}"
+ "mariadb_${MAJOR_VERSION}${MINOR_VERSION} = %{version}-%{release}"
+ "mariadb-${MAJOR_VERSION}${MINOR_VERSION} = %{version}-%{release}"
+ "mariadb-server = %{version}-%{release}"
+ )
ENDIF()
# If we want to build build MariaDB-shared-compat,
diff --git a/mysql-test/r/processlist_notembedded.result b/mysql-test/r/processlist_notembedded.result
index e6b30f3ec70..d7f38b69d9b 100644
--- a/mysql-test/r/processlist_notembedded.result
+++ b/mysql-test/r/processlist_notembedded.result
@@ -1,8 +1,9 @@
#
# MDEV-20466: SHOW PROCESSLIST truncates query text on \0 bytes
#
-SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync';
+SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync WAIT_FOR go';
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
FOUND /sleep/ in MDEV-20466.text
+SET DEBUG_SYNC= 'now SIGNAL go';
SET DEBUG_SYNC = 'RESET';
End of 5.5 tests
diff --git a/mysql-test/suite/innodb/r/foreign-keys.result b/mysql-test/suite/innodb/r/foreign-keys.result
deleted file mode 100644
index 10e0b1f3d7b..00000000000
--- a/mysql-test/suite/innodb/r/foreign-keys.result
+++ /dev/null
@@ -1,126 +0,0 @@
-#
-# Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE
-# ADD FOREIGN KEY
-#
-CREATE TABLE `department` (`department_id` INT, `department_people_fk` INT,
-PRIMARY KEY (`department_id`)) engine=innodb;
-CREATE TABLE `title` (`title_id` INT, `title_manager_fk` INT,
-`title_reporter_fk` INT, PRIMARY KEY (`title_id`)) engine=innodb;
-CREATE TABLE `people` (`people_id` INT, PRIMARY KEY (`people_id`)) engine=innodb;
-ALTER TABLE `department` ADD FOREIGN KEY (`department_people_fk`) REFERENCES
-`people` (`people_id`);
-ALTER TABLE `title` ADD FOREIGN KEY (`title_manager_fk`) REFERENCES `people`
-(`people_id`);
-ALTER TABLE `title` ADD FOREIGN KEY (`title_reporter_fk`) REFERENCES `people`
-(`people_id`);
-drop table title, department, people;
-create table t1 (a int primary key, b int) engine=innodb;
-create table t2 (c int primary key, d int,
-foreign key (d) references t1 (a) on update cascade) engine=innodb;
-insert t1 values (1,1),(2,2),(3,3);
-insert t2 values (4,1),(5,2),(6,3);
-flush table t2 with read lock;
-connect con1,localhost,root;
-delete from t1 where a=2;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE)
-update t1 set a=10 where a=1;
-connection default;
-unlock tables;
-connection con1;
-connection default;
-lock table t2 write;
-connection con1;
-delete from t1 where a=2;
-connection default;
-unlock tables;
-connection con1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE)
-connection default;
-unlock tables;
-disconnect con1;
-create user foo;
-grant select,update on test.t1 to foo;
-connect foo,localhost,foo;
-update t1 set a=30 where a=3;
-disconnect foo;
-connection default;
-select * from t2;
-c d
-5 2
-4 10
-6 30
-drop table t2, t1;
-drop user foo;
-create table t1 (f1 int primary key) engine=innodb;
-create table t2 (f2 int primary key) engine=innodb;
-create table t3 (f3 int primary key, foreign key (f3) references t2(f2)) engine=innodb;
-insert into t1 values (1),(2),(3),(4),(5);
-insert into t2 values (1),(2),(3),(4),(5);
-insert into t3 values (1),(2),(3),(4),(5);
-connect con1,localhost,root;
-set debug_sync='alter_table_before_rename_result_table signal g1 wait_for g2';
-alter table t2 add constraint foreign key (f2) references t1(f1) on delete cascade on update cascade;
-connection default;
-set debug_sync='before_execute_sql_command wait_for g1';
-update t1 set f1 = f1 + 100000 limit 2;
-connect con2,localhost,root;
-kill query UPDATE;
-disconnect con2;
-connection default;
-ERROR 70100: Query execution was interrupted
-set debug_sync='now signal g2';
-connection con1;
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `f2` int(11) NOT NULL,
- PRIMARY KEY (`f2`),
- CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) ON DELETE CASCADE ON UPDATE CASCADE
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-disconnect con1;
-connection default;
-select * from t2 where f2 not in (select f1 from t1);
-f2
-select * from t3 where f3 not in (select f2 from t2);
-f3
-drop table t3;
-drop table t2;
-drop table t1;
-set debug_sync='reset';
-#
-# MDEV-17595 - Server crashes in copy_data_between_tables or
-# Assertion `thd->transaction.stmt.is_empty() ||
-# (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)'
-# fails in close_tables_for_reopen upon concurrent
-# ALTER TABLE and FLUSH
-#
-CREATE TABLE t1 (a INT, KEY(a)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES(1),(2);
-CREATE TABLE t2 (b INT, KEY(b)) ENGINE=InnoDB;
-INSERT INTO t2 VALUES(2);
-ALTER TABLE t2 ADD FOREIGN KEY(b) REFERENCES t1(a), LOCK=EXCLUSIVE;
-DROP TABLE t2, t1;
-#
-# MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name)
-#
-CREATE TABLE t1 (`pk` INT PRIMARY KEY) ENGINE=InnoDB;
-CREATE TABLE t2 LIKE t1;
-FLUSH TABLES;
-SET debug_sync='alter_table_intermediate_table_created SIGNAL ready WAIT_FOR go';
-ALTER TABLE t1 ADD FOREIGN KEY(pk) REFERENCES t2(pk) ON UPDATE CASCADE;
-connect con1, localhost, root;
-SET debug_sync='now WAIT_FOR ready';
-SET lock_wait_timeout=1;
-UPDATE t2 SET pk=10 WHERE pk=1;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-PREPARE stmt FROM 'UPDATE t2 SET pk=10 WHERE pk=1';
-DEALLOCATE PREPARE stmt;
-FLUSH TABLE t2;
-SET debug_sync='now SIGNAL go';
-connection default;
-disconnect con1;
-connection default;
-SET debug_sync='reset';
-SHOW OPEN TABLES FROM test;
-Database Table In_use Name_locked
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result
index 7098faca0c9..378fe74e14b 100644
--- a/mysql-test/suite/innodb/r/foreign_key.result
+++ b/mysql-test/suite/innodb/r/foreign_key.result
@@ -130,3 +130,106 @@ ALTER TABLE t1 DROP f3;
ALTER TABLE t1 CHANGE f f3 INT;
DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=1;
+#
+# Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE
+# ADD FOREIGN KEY
+#
+CREATE TABLE `department` (`department_id` INT, `department_people_fk` INT,
+PRIMARY KEY (`department_id`)) engine=innodb;
+CREATE TABLE `title` (`title_id` INT, `title_manager_fk` INT,
+`title_reporter_fk` INT, PRIMARY KEY (`title_id`)) engine=innodb;
+CREATE TABLE `people` (`people_id` INT, PRIMARY KEY (`people_id`)) engine=innodb;
+ALTER TABLE `department` ADD FOREIGN KEY (`department_people_fk`) REFERENCES
+`people` (`people_id`);
+ALTER TABLE `title` ADD FOREIGN KEY (`title_manager_fk`) REFERENCES `people`
+(`people_id`);
+ALTER TABLE `title` ADD FOREIGN KEY (`title_reporter_fk`) REFERENCES `people`
+(`people_id`);
+drop table title, department, people;
+create table t1 (a int primary key, b int) engine=innodb;
+create table t2 (c int primary key, d int,
+foreign key (d) references t1 (a) on update cascade) engine=innodb;
+insert t1 values (1,1),(2,2),(3,3);
+insert t2 values (4,1),(5,2),(6,3);
+flush table t2 with read lock;
+delete from t1 where a=2;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE)
+update t1 set a=10 where a=1;
+unlock tables;
+lock table t2 write;
+delete from t1 where a=2;
+unlock tables;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`d`) REFERENCES `t1` (`a`) ON UPDATE CASCADE)
+unlock tables;
+create user foo;
+grant select,update on test.t1 to foo;
+update t1 set a=30 where a=3;
+select * from t2;
+c d
+5 2
+4 10
+6 30
+drop table t2, t1;
+drop user foo;
+#
+# MDEV-17595 - Server crashes in copy_data_between_tables or
+# Assertion `thd->transaction.stmt.is_empty() ||
+# (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)'
+# fails in close_tables_for_reopen upon concurrent
+# ALTER TABLE and FLUSH
+#
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1),(2);
+CREATE TABLE t2 (b INT, KEY(b)) ENGINE=InnoDB;
+INSERT INTO t2 VALUES(2);
+ALTER TABLE t2 ADD FOREIGN KEY(b) REFERENCES t1(a), LOCK=EXCLUSIVE;
+DROP TABLE t2, t1;
+create table t1 (pk int primary key, data int) engine=innodb;
+insert t1 values (1,1),(2,2),(3,3);
+create table t2 (t1_pk int, foreign key (t1_pk) references t1 (pk)) engine=innodb;
+insert t2 values (1),(2);
+insert t2 values (10);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`t1_pk`) REFERENCES `t1` (`pk`))
+flush tables;
+flush status;
+update t1 set data=10 where pk+1>10;
+show status like '%opened_tab%';
+Variable_name Value
+Opened_table_definitions 1
+Opened_tables 1
+flush tables;
+flush status;
+update t2 set t1_pk=11 where t1_pk+1>10;
+show status like '%opened_tab%';
+Variable_name Value
+Opened_table_definitions 1
+Opened_tables 1
+flush tables;
+flush status;
+lock tables t1 write;
+show status like '%opened_tab%';
+Variable_name Value
+Opened_table_definitions 2
+Opened_tables 2
+insert t1 values (4,4);
+show status like '%opened_tab%';
+Variable_name Value
+Opened_table_definitions 2
+Opened_tables 2
+unlock tables;
+create function foo() returns int
+begin
+insert t1 values (5,5);
+return 5;
+end|
+flush tables;
+flush status;
+select foo();
+foo()
+5
+show status like '%opened_tab%';
+Variable_name Value
+Opened_table_definitions 2
+Opened_tables 2
+drop function foo;
+drop table t2, t1;
diff --git a/mysql-test/suite/innodb/r/foreign_key_debug.result b/mysql-test/suite/innodb/r/foreign_key_debug.result
new file mode 100644
index 00000000000..741200b62b2
--- /dev/null
+++ b/mysql-test/suite/innodb/r/foreign_key_debug.result
@@ -0,0 +1,60 @@
+create table t1 (f1 int primary key) engine=innodb;
+create table t2 (f2 int primary key) engine=innodb;
+create table t3 (f3 int primary key, foreign key (f3) references t2(f2)) engine=innodb;
+insert into t1 values (1),(2),(3),(4),(5);
+insert into t2 values (1),(2),(3),(4),(5);
+insert into t3 values (1),(2),(3),(4),(5);
+connect con1,localhost,root;
+set debug_sync='alter_table_before_rename_result_table signal g1 wait_for g2';
+alter table t2 add constraint foreign key (f2) references t1(f1) on delete cascade on update cascade;
+connection default;
+set debug_sync='before_execute_sql_command wait_for g1';
+update t1 set f1 = f1 + 100000 limit 2;
+connect con2,localhost,root;
+kill query UPDATE;
+disconnect con2;
+connection default;
+ERROR 70100: Query execution was interrupted
+set debug_sync='now signal g2';
+connection con1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `f2` int(11) NOT NULL,
+ PRIMARY KEY (`f2`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+disconnect con1;
+connection default;
+select * from t2 where f2 not in (select f1 from t1);
+f2
+select * from t3 where f3 not in (select f2 from t2);
+f3
+drop table t3;
+drop table t2;
+drop table t1;
+set debug_sync='reset';
+#
+# MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name)
+#
+CREATE TABLE t1 (`pk` INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 LIKE t1;
+FLUSH TABLES;
+SET debug_sync='alter_table_intermediate_table_created SIGNAL ready WAIT_FOR go';
+ALTER TABLE t1 ADD FOREIGN KEY(pk) REFERENCES t2(pk) ON UPDATE CASCADE;
+connect con1, localhost, root;
+SET debug_sync='now WAIT_FOR ready';
+SET lock_wait_timeout=1;
+UPDATE t2 SET pk=10 WHERE pk=1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+PREPARE stmt FROM 'UPDATE t2 SET pk=10 WHERE pk=1';
+DEALLOCATE PREPARE stmt;
+FLUSH TABLE t2;
+SET debug_sync='now SIGNAL go';
+connection default;
+disconnect con1;
+connection default;
+SET debug_sync='reset';
+SHOW OPEN TABLES FROM test;
+Database Table In_use Name_locked
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/innodb/t/foreign-keys.test b/mysql-test/suite/innodb/t/foreign-keys.test
deleted file mode 100644
index a19fe3876f3..00000000000
--- a/mysql-test/suite/innodb/t/foreign-keys.test
+++ /dev/null
@@ -1,160 +0,0 @@
---source include/have_innodb.inc
---source include/have_debug.inc
---source include/have_debug_sync.inc
-
---enable_connect_log
-
---echo #
---echo # Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE
---echo # ADD FOREIGN KEY
---echo #
-
-CREATE TABLE `department` (`department_id` INT, `department_people_fk` INT,
-PRIMARY KEY (`department_id`)) engine=innodb;
-
-CREATE TABLE `title` (`title_id` INT, `title_manager_fk` INT,
-`title_reporter_fk` INT, PRIMARY KEY (`title_id`)) engine=innodb;
-
-CREATE TABLE `people` (`people_id` INT, PRIMARY KEY (`people_id`)) engine=innodb;
-
-ALTER TABLE `department` ADD FOREIGN KEY (`department_people_fk`) REFERENCES
-`people` (`people_id`);
-
-ALTER TABLE `title` ADD FOREIGN KEY (`title_manager_fk`) REFERENCES `people`
-(`people_id`);
-
-ALTER TABLE `title` ADD FOREIGN KEY (`title_reporter_fk`) REFERENCES `people`
-(`people_id`);
-
-drop table title, department, people;
-
-#
-# FK and prelocking:
-# child table accesses (reads and writes) wait for locks.
-#
-create table t1 (a int primary key, b int) engine=innodb;
-create table t2 (c int primary key, d int,
- foreign key (d) references t1 (a) on update cascade) engine=innodb;
-insert t1 values (1,1),(2,2),(3,3);
-insert t2 values (4,1),(5,2),(6,3);
-flush table t2 with read lock; # this takes MDL_SHARED_NO_WRITE
-connect (con1,localhost,root);
---error ER_ROW_IS_REFERENCED_2
-delete from t1 where a=2;
-send update t1 set a=10 where a=1;
-connection default;
-let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock';
-source include/wait_condition.inc;
-unlock tables;
-connection con1;
-reap;
-connection default;
-lock table t2 write; # this takes MDL_SHARED_NO_READ_WRITE
-connection con1;
-send delete from t1 where a=2;
-connection default;
-let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock';
-source include/wait_condition.inc;
-unlock tables;
-connection con1;
---error ER_ROW_IS_REFERENCED_2
-reap;
-connection default;
-unlock tables;
-disconnect con1;
-
-# but privileges should not be checked
-create user foo;
-grant select,update on test.t1 to foo;
-connect(foo,localhost,foo);
-update t1 set a=30 where a=3;
-disconnect foo;
-connection default;
-select * from t2;
-drop table t2, t1;
-drop user foo;
-
-#
-# MDEV-16465 Invalid (old?) table or database name or hang in ha_innobase::delete_table and log semaphore wait upon concurrent DDL with foreign keys
-#
-create table t1 (f1 int primary key) engine=innodb;
-create table t2 (f2 int primary key) engine=innodb;
-create table t3 (f3 int primary key, foreign key (f3) references t2(f2)) engine=innodb;
-insert into t1 values (1),(2),(3),(4),(5);
-insert into t2 values (1),(2),(3),(4),(5);
-insert into t3 values (1),(2),(3),(4),(5);
-connect con1,localhost,root;
-set debug_sync='alter_table_before_rename_result_table signal g1 wait_for g2';
-send alter table t2 add constraint foreign key (f2) references t1(f1) on delete cascade on update cascade;
-connection default;
-let $conn=`select connection_id()`;
-set debug_sync='before_execute_sql_command wait_for g1';
-send update t1 set f1 = f1 + 100000 limit 2;
-connect con2,localhost,root;
-let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock' and info like 'update t1 %';
-source include/wait_condition.inc;
---replace_result $conn UPDATE
-eval kill query $conn;
-disconnect con2;
-connection default;
-error ER_QUERY_INTERRUPTED;
-reap;
-set debug_sync='now signal g2';
-connection con1;
-reap;
-show create table t2;
-disconnect con1;
-connection default;
-select * from t2 where f2 not in (select f1 from t1);
-select * from t3 where f3 not in (select f2 from t2);
-drop table t3;
-drop table t2;
-drop table t1;
-set debug_sync='reset';
-
-
---echo #
---echo # MDEV-17595 - Server crashes in copy_data_between_tables or
---echo # Assertion `thd->transaction.stmt.is_empty() ||
---echo # (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)'
---echo # fails in close_tables_for_reopen upon concurrent
---echo # ALTER TABLE and FLUSH
---echo #
-CREATE TABLE t1 (a INT, KEY(a)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES(1),(2);
-CREATE TABLE t2 (b INT, KEY(b)) ENGINE=InnoDB;
-INSERT INTO t2 VALUES(2);
-ALTER TABLE t2 ADD FOREIGN KEY(b) REFERENCES t1(a), LOCK=EXCLUSIVE;
-DROP TABLE t2, t1;
-
-
---echo #
---echo # MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name)
---echo #
-CREATE TABLE t1 (`pk` INT PRIMARY KEY) ENGINE=InnoDB;
-CREATE TABLE t2 LIKE t1;
-FLUSH TABLES;
-
-SET debug_sync='alter_table_intermediate_table_created SIGNAL ready WAIT_FOR go';
-send ALTER TABLE t1 ADD FOREIGN KEY(pk) REFERENCES t2(pk) ON UPDATE CASCADE;
-
-connect con1, localhost, root;
-SET debug_sync='now WAIT_FOR ready';
-SET lock_wait_timeout=1; # change to 0 in 10.3
---error ER_LOCK_WAIT_TIMEOUT
-UPDATE t2 SET pk=10 WHERE pk=1;
-PREPARE stmt FROM 'UPDATE t2 SET pk=10 WHERE pk=1';
-DEALLOCATE PREPARE stmt;
-FLUSH TABLE t2;
-SET debug_sync='now SIGNAL go';
-
-connection default;
-reap;
-
-# Cleanup
-disconnect con1;
-
-connection default;
-SET debug_sync='reset';
-SHOW OPEN TABLES FROM test;
-DROP TABLE t1, t2;
diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test
index afaeaa073a2..b33fbf60675 100644
--- a/mysql-test/suite/innodb/t/foreign_key.test
+++ b/mysql-test/suite/innodb/t/foreign_key.test
@@ -158,3 +158,133 @@ ALTER TABLE t1 CHANGE f f3 INT;
DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=1;
+
+--echo #
+--echo # Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE
+--echo # ADD FOREIGN KEY
+--echo #
+
+CREATE TABLE `department` (`department_id` INT, `department_people_fk` INT,
+PRIMARY KEY (`department_id`)) engine=innodb;
+
+CREATE TABLE `title` (`title_id` INT, `title_manager_fk` INT,
+`title_reporter_fk` INT, PRIMARY KEY (`title_id`)) engine=innodb;
+
+CREATE TABLE `people` (`people_id` INT, PRIMARY KEY (`people_id`)) engine=innodb;
+
+ALTER TABLE `department` ADD FOREIGN KEY (`department_people_fk`) REFERENCES
+`people` (`people_id`);
+
+ALTER TABLE `title` ADD FOREIGN KEY (`title_manager_fk`) REFERENCES `people`
+(`people_id`);
+
+ALTER TABLE `title` ADD FOREIGN KEY (`title_reporter_fk`) REFERENCES `people`
+(`people_id`);
+
+drop table title, department, people;
+
+#
+# FK and prelocking:
+# child table accesses (reads and writes) wait for locks.
+#
+create table t1 (a int primary key, b int) engine=innodb;
+create table t2 (c int primary key, d int,
+ foreign key (d) references t1 (a) on update cascade) engine=innodb;
+insert t1 values (1,1),(2,2),(3,3);
+insert t2 values (4,1),(5,2),(6,3);
+flush table t2 with read lock; # this takes MDL_SHARED_NO_WRITE
+connect (con1,localhost,root);
+--error ER_ROW_IS_REFERENCED_2
+delete from t1 where a=2;
+send update t1 set a=10 where a=1;
+connection default;
+let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock';
+source include/wait_condition.inc;
+unlock tables;
+connection con1;
+reap;
+connection default;
+lock table t2 write; # this takes MDL_SHARED_NO_READ_WRITE
+connection con1;
+send delete from t1 where a=2;
+connection default;
+let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock';
+source include/wait_condition.inc;
+unlock tables;
+connection con1;
+--error ER_ROW_IS_REFERENCED_2
+reap;
+connection default;
+unlock tables;
+disconnect con1;
+
+# but privileges should not be checked
+create user foo;
+grant select,update on test.t1 to foo;
+connect(foo,localhost,foo);
+update t1 set a=30 where a=3;
+disconnect foo;
+connection default;
+select * from t2;
+drop table t2, t1;
+drop user foo;
+
+--echo #
+--echo # MDEV-17595 - Server crashes in copy_data_between_tables or
+--echo # Assertion `thd->transaction.stmt.is_empty() ||
+--echo # (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)'
+--echo # fails in close_tables_for_reopen upon concurrent
+--echo # ALTER TABLE and FLUSH
+--echo #
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1),(2);
+CREATE TABLE t2 (b INT, KEY(b)) ENGINE=InnoDB;
+INSERT INTO t2 VALUES(2);
+ALTER TABLE t2 ADD FOREIGN KEY(b) REFERENCES t1(a), LOCK=EXCLUSIVE;
+DROP TABLE t2, t1;
+
+#
+# MDEV-22180 Planner opens unnecessary tables when updated table is referenced by foreign keys
+#
+
+create table t1 (pk int primary key, data int) engine=innodb;
+insert t1 values (1,1),(2,2),(3,3);
+create table t2 (t1_pk int, foreign key (t1_pk) references t1 (pk)) engine=innodb;
+insert t2 values (1),(2);
+error ER_NO_REFERENCED_ROW_2;
+insert t2 values (10);
+flush tables;
+flush status;
+# with ON UPDATE RESTRICT child tables are not opened
+update t1 set data=10 where pk+1>10;
+show status like '%opened_tab%';
+flush tables;
+flush status;
+# neither are parent tables
+update t2 set t1_pk=11 where t1_pk+1>10;
+show status like '%opened_tab%';
+# under LOCK TABLES
+flush tables;
+flush status;
+lock tables t1 write;
+show status like '%opened_tab%';
+insert t1 values (4,4);
+show status like '%opened_tab%';
+unlock tables;
+delimiter |;
+create function foo() returns int
+begin
+ insert t1 values (5,5);
+ return 5;
+end|
+delimiter ;|
+flush tables;
+flush status;
+select foo();
+show status like '%opened_tab%';
+drop function foo;
+drop table t2, t1;
+
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/suite/innodb/t/foreign_key_debug.test b/mysql-test/suite/innodb/t/foreign_key_debug.test
new file mode 100644
index 00000000000..75d05801b5f
--- /dev/null
+++ b/mysql-test/suite/innodb/t/foreign_key_debug.test
@@ -0,0 +1,78 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+--enable_connect_log
+
+#
+# MDEV-16465 Invalid (old?) table or database name or hang in ha_innobase::delete_table and log semaphore wait upon concurrent DDL with foreign keys
+#
+create table t1 (f1 int primary key) engine=innodb;
+create table t2 (f2 int primary key) engine=innodb;
+create table t3 (f3 int primary key, foreign key (f3) references t2(f2)) engine=innodb;
+insert into t1 values (1),(2),(3),(4),(5);
+insert into t2 values (1),(2),(3),(4),(5);
+insert into t3 values (1),(2),(3),(4),(5);
+connect con1,localhost,root;
+set debug_sync='alter_table_before_rename_result_table signal g1 wait_for g2';
+send alter table t2 add constraint foreign key (f2) references t1(f1) on delete cascade on update cascade;
+connection default;
+let $conn=`select connection_id()`;
+set debug_sync='before_execute_sql_command wait_for g1';
+send update t1 set f1 = f1 + 100000 limit 2;
+connect con2,localhost,root;
+let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock' and info like 'update t1 %';
+source include/wait_condition.inc;
+--replace_result $conn UPDATE
+eval kill query $conn;
+disconnect con2;
+connection default;
+error ER_QUERY_INTERRUPTED;
+reap;
+set debug_sync='now signal g2';
+connection con1;
+reap;
+show create table t2;
+disconnect con1;
+connection default;
+select * from t2 where f2 not in (select f1 from t1);
+select * from t3 where f3 not in (select f2 from t2);
+drop table t3;
+drop table t2;
+drop table t1;
+set debug_sync='reset';
+
+--echo #
+--echo # MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name)
+--echo #
+CREATE TABLE t1 (`pk` INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 LIKE t1;
+FLUSH TABLES;
+
+SET debug_sync='alter_table_intermediate_table_created SIGNAL ready WAIT_FOR go';
+send ALTER TABLE t1 ADD FOREIGN KEY(pk) REFERENCES t2(pk) ON UPDATE CASCADE;
+
+connect con1, localhost, root;
+SET debug_sync='now WAIT_FOR ready';
+SET lock_wait_timeout=1; # change to 0 in 10.3
+--error ER_LOCK_WAIT_TIMEOUT
+UPDATE t2 SET pk=10 WHERE pk=1;
+PREPARE stmt FROM 'UPDATE t2 SET pk=10 WHERE pk=1';
+DEALLOCATE PREPARE stmt;
+FLUSH TABLE t2;
+SET debug_sync='now SIGNAL go';
+
+connection default;
+reap;
+
+# Cleanup
+disconnect con1;
+
+connection default;
+SET debug_sync='reset';
+SHOW OPEN TABLES FROM test;
+DROP TABLE t1, t2;
+
+#
+# End of 10.1 tests
+#
diff --git a/mysql-test/t/processlist_notembedded.test b/mysql-test/t/processlist_notembedded.test
index dc970cf5709..b07ac00a44a 100644
--- a/mysql-test/t/processlist_notembedded.test
+++ b/mysql-test/t/processlist_notembedded.test
@@ -1,6 +1,7 @@
source include/have_debug.inc;
source include/have_debug_sync.inc;
source include/not_embedded.inc;
+source include/count_sessions.inc;
--echo #
--echo # MDEV-20466: SHOW PROCESSLIST truncates query text on \0 bytes
@@ -10,9 +11,9 @@ connect (con1,localhost,root,,);
connection con1;
-let $q= `select CONCAT("SELECT user FROM mysql.user WHERE user ='some", CHAR(0), "' or sleep (30)")`;
+let $q= `select CONCAT("SELECT user FROM mysql.user WHERE user ='some", CHAR(0), "sleep'")`;
-SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync';
+SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync WAIT_FOR go';
--disable_query_log
--send_eval $q;
--enable_query_log
@@ -27,8 +28,12 @@ let SEARCH_PATTERN=sleep;
source include/search_pattern_in_file.inc;
remove_file $MYSQLTEST_VARDIR/tmp//MDEV-20466.text;
+SET DEBUG_SYNC= 'now SIGNAL go';
+
disconnect con1;
SET DEBUG_SYNC = 'RESET';
+source include/wait_until_count_sessions.inc;
+
--echo End of 5.5 tests
diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests
index e78157ca6c4..c7b95745198 100644
--- a/mysql-test/unstable-tests
+++ b/mysql-test/unstable-tests
@@ -23,7 +23,7 @@
#
##############################################################################
#
-# Based on bb-10.1-release 599a06098b967db3d636c1053bdbdd0011cba606
+# Based on 10.1 d233fd14a39f9c583b85ffb03e42b5ea52e2f4c2
main.alter_table_trans : MDEV-12084 - timeout
main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result
@@ -36,75 +36,64 @@ main.ctype_utf16 : MDEV-10675: timeout or extra warnings
main.debug_sync : MDEV-10607 - internal error
main.derived_opt : MDEV-11768 - timeout
main.dirty_close : MDEV-19368 - mysqltest failed but provided no output
-main.drop_bad_db_type : Modified in 10.1.42
-main.drop_debug : Modified in 10.1.42
main.events_2 : MDEV-13277 - Server crash
main.events_bugs : MDEV-12892 - Crash in fill_schema_processlist; modified in 10.1.44
main.events_restart : MDEV-12236 - Server shutdown problem
main.events_slowlog : MDEV-12821 - Wrong result
main.flush : MDEV-19368 - mysqltest failed but provided no output
main.func_gconcat : MDEV-21379 - Valgrind warnings
-main.func_math : Modified in 10.1.42
+main.func_math : Modified in 10.1.45
main.func_misc : Modified in 10.1.44
main.gis : MDEV-13411 - wrong result on P8
main.gis_notembedded : MDEV-21264 - Wrong result with different default charset
-main.group_by : MDEV-21565 - Wrong result; modified in 10.1.44
main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown
main.index_intersect_innodb : MDEV-10643 - failed with timeout
-main.index_merge_innodb : MDEV-7142 - Wrong execution plan, timeout with valgrind; modified in 10.1.42
-main.index_merge_myisam : Modified in 10.1.42
-main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure
+main.index_merge_innodb : MDEV-7142 - Wrong execution plan, timeout with valgrind
+main.index_merge_myisam : Modified in 10.1.45
+main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure (Fixed in 10.3+)
main.insert_debug : Added in 10.1.44
-main.join : Modified in 10.1.42
main.kill_processlist-6619 : MDEV-10793 - wrong result in processlist
main.loaddata : MDEV-19368 - mysqltest failed but provided no output
main.locale : MDEV-20521 - Wrong result (missing warning)
main.log_slow : MDEV-13263 - Wrong result
-main.log_slow_debug : Modified in 10.1.42
main.log_tables-big : MDEV-13408 - wrong result
main.mdev-504 : MDEV-10607 - sporadic "can't connect"
main.mdev375 : MDEV-10607 - sporadic "can't connect"
main.merge : MDEV-10607 - sporadic "can't connect"
-main.multi_update_debug : MDEV-20136 - Debug sync point wait timed out
-main.myisam : Modified in 10.1.42
+main.multi_update_debug : MDEV-20136 - Debug sync point wait timed out (Fixed in 10.2+)
main.mysql_client_test : MDEV-19369 - error: 5888, status: 23, errno: 2
main.mysql_client_test_comp : MDEV-19369 - error: 5888, status: 23, errno: 2
main.mysql_client_test_nonblock : MDEV-15096 - exec failed
main.mysql_upgrade_noengine : MDEV-14355 - Plugin is busy
+main.mysqld--defaults-file : Modified in 10.1.45
+main.mysqldump : Modified in 10.1.45
main.mysqlhotcopy_myisam : MDEV-10995 - test hangs on debug build
main.mysqlslap : MDEV-11801 - timeout
main.mysqltest : MDEV-9269 - fails on Alpha
main.old-mode : MDEV-19373 - Wrong result
main.order_by : Modified in 10.1.44
-main.order_by_innodb : Modified in 10.1.42
main.order_by_optimizer_innodb : MDEV-10683 - wrong execution plan
-main.partition_debug_sync : MDEV-15669 - Deadlock found when trying to get lock; modified in 10.1.42
+main.partition_debug_sync : MDEV-15669 - Deadlock found when trying to get lock
main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings
-main.processlist : Modified in 10.1.42
-main.processlist_notembedded : Added in 10.1.42
main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count
main.query_cache : MDEV-12895 - Wrong result
main.query_cache_debug : MDEV-15281 - Resize or similar command in progress
+main.range : Modified in 10.1.45
+main.range_innodb : Modified in 10.1.45
main.range_vs_index_merge_innodb : MDEV-15283 - Server has gone away
main.selectivity : Modified in 10.1.44
main.set_statement : MDEV-13183 - Wrong result
main.show_explain : MDEV-10674 - sporadic failure
-main.sp : Modified in 10.1.42
-main.sp-code : Modified in 10.1.42
main.sp-security : MDEV-10607 - sporadic "can't connect"
main.sp_notembedded : MDEV-10607 - internal error
main.stat_tables_par_innodb : MDEV-14155 - wrong rounding
main.status : MDEV-8510 - sporadic wrong result
main.subselect_innodb : MDEV-10614 - sporadic wrong results
-main.subselect_sj : Modified in 10.1.42
-main.sum_distinct-big : Modified in 10.1.42
main.tc_heuristic_recover : MDEV-15200 - wrong error on mysqld_stub_cmd
main.type_blob : MDEV-15195 - Wrong result
-main.type_date : Modified in 10.1.42
main.type_datetime : Modified in 10.1.44
main.type_datetime_hires : MDEV-10687 - timeout
main.type_int : Modified in 10.1.44
-main.type_newdecimal : Modified in 10.1.42
main.type_time : Modified in 10.1.44
main.wait_timeout : Lost connection to MySQL server during query
main.xa : MDEV-11769 - lock wait timeout
@@ -123,29 +112,26 @@ archive-test_sql_discovery.discover : MDEV-16817 - Table marked as crashed
#-----------------------------------------------------------------------
binlog.binlog_commit_wait : MDEV-10150 - Error: too much time elapsed
-binlog.binlog_invalid_read_in_rotate : Added in 10.1.44
+binlog.binlog_invalid_read_in_rotate : MDEV-22455 - Server crash; added in 10.1.44
binlog.binlog_killed : MDEV-12925 - Wrong result
binlog.binlog_parallel_replication_marks_row : Include file modified in 10.1.44
binlog.binlog_parallel_replication_marks_stm_mix : Include file modified in 10.1.44
-binlog.binlog_row_drop_tmp_tbl : Include file modified in 10.1.42
binlog.binlog_show_binlog_event_random_pos : Added in 10.1.44
-binlog.binlog_stm_drop_tmp_tbl : Include file modified in 10.1.42
binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint
binlog.load_data_stm_view : MDEV-16948 - Wrong result
#-----------------------------------------------------------------------
-binlog_encryption.binlog_xa_recover : MDEV-12908 - Extra checkpoint
-binlog_encryption.encrypted_master : MDEV-12906 - Failed to sync
-binlog_encryption.multisource : MDEV-21289 - Wrong error code
-binlog_encryption.rpl_corruption : Include file modified in 10.1.44
-binlog_encryption.rpl_parallel : MDEV-10653 - Timeout
-binlog_encryption.rpl_parallel_ignored_errors : Added in 10.1.42
-binlog_encryption.rpl_relayrotate : MDEV-15194 - Timeout
-binlog_encryption.rpl_semi_sync : MDEV-11220 - Wrong result, MDEV-11673 - Valgrind warning
-binlog_encryption.rpl_ssl : MDEV-14507 - Timeout on SLES 11.4
-binlog_encryption.rpl_stm_relay_ign_space : MDEV-19375 - Test assertion failed in assertion.inc
-binlog_encryption.rpl_typeconv : MDEV-14362 - Lost connection to MySQL server during query
+binlog_encryption.binlog_xa_recover : MDEV-12908 - Extra checkpoint
+binlog_encryption.encrypted_master : MDEV-12906 - Failed to sync
+binlog_encryption.multisource : MDEV-21289 - Wrong error code
+binlog_encryption.rpl_corruption : Include file modified in 10.1.44
+binlog_encryption.rpl_parallel : MDEV-10653 - Timeout
+binlog_encryption.rpl_relayrotate : MDEV-15194 - Timeout
+binlog_encryption.rpl_semi_sync : MDEV-11220 - Wrong result, MDEV-11673 - Valgrind warning
+binlog_encryption.rpl_ssl : MDEV-14507 - Timeout on SLES 11.4
+binlog_encryption.rpl_stm_relay_ign_space : MDEV-19375 - Test assertion failed in assertion.inc
+binlog_encryption.rpl_typeconv : MDEV-14362 - Lost connection to MySQL server during query
#-----------------------------------------------------------------------
@@ -160,6 +146,10 @@ connect.zip : MDEV-13884 - Wrong result
#-----------------------------------------------------------------------
+disks.disks_notembedded : MDEV-21587 - Wrong result
+
+#-----------------------------------------------------------------------
+
encryption.create_or_replace : MDEV-16115 - Trying to access tablespace
encryption.debug_key_management : MDEV-13841 - Timeout on wait condition
encryption.encrypt_and_grep : MDEV-13765 - Wrong result
@@ -170,6 +160,7 @@ encryption.innodb-page_encryption : MDEV-10641 - mutex problem
encryption.innodb-read-only : MDEV-14728 - Unable to get certificate; MDEV-16563 - Crash on startup
encryption.innodb-redo-badkey : MDEV-12898 - Server hang on startup
encryption.innodb-remove-encryption : MDEV-16493 - Timeout in wait condition
+encryption.innodb_encryption : MDEV-14728 - Unable to get certificate
encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion failure
encryption.innodb_encryption_discard_import : MDEV-16116 - Wrong result
encryption.innodb_encryption_is : MDEV-12898 - Server hang on startup
@@ -228,12 +219,12 @@ galera_3nodes.* : The suite has not been stabilized yet
innodb.binlog_consistent : MDEV-10618 - Server fails to start
innodb.doublewrite : MDEV-12905 - Lost connection to MySQL server; MDEV-21380 - Assertion failure
+innodb.foreign_key : Modified in 10.1.45
innodb.group_commit_crash : MDEV-11770 - Checksum mismatch
innodb.group_commit_crash_no_optimize_thread : MDEV-11770 - Checksum mismatch
innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup
innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS
innodb.innodb-alter-table : MDEV-10619 - Testcase timeout
-innodb.innodb-autoinc : Modified in 10.1.42
innodb.innodb-blob : MDEV-12053 - Client crash
innodb.innodb-fk : MDEV-13832 - Assertion failure on shutdown
innodb.innodb-page_compression_default : MDEV-14121 - Assertion failure
@@ -247,22 +238,21 @@ innodb.innodb_monitor : MDEV-10939 - Testcase timeout
innodb.innodb_mysql : MDEV-19873 - Wrong result
innodb.innodb_stats : MDEV-10682 - Wrong result
innodb.innodb_sys_semaphore_waits : MDEV-10331 - Wrong result
+innodb.innodb_sys_var_valgrind : Added in 10.1.45
innodb.innodb_zip_innochecksum2 : MDEV-13882 - Warning: difficult to find free blocks
innodb.log_file_size : MDEV-15668 - Not found pattern
innodb.recovery_shutdown : MDEV-15671 - Warning: database page corruption
innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace
-innodb.stat_tables : Added in 10.1.42
innodb.table_definition_cache_debug : MDEV-14206 - Extra warning
innodb.table_flags : MDEV-19374 - Server failed to restart
-innodb.trx_id_future : Modified in 10.1.42
innodb.xa_recovery : MDEV-15279 - mysqld got exception
#-----------------------------------------------------------------------
-innodb_fts.concurrent_insert : Modified in 10.1.42
-innodb_fts.crash_recovery : Modified in 10.1.42
innodb_fts.innodb_fts_misc : Modified in 10.1.44
innodb_fts.innodb_fts_misc_debug : MDEV-14156 - Unexpected warning
+innodb_fts.misc_debug2 : Added in 10.1.45
+innodb_fts.stopword : Added in 10.1.45
#-----------------------------------------------------------------------
@@ -308,12 +298,8 @@ multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_h
parts.partition_alter2_2_maria : MDEV-14364 - Lost connection to MySQL server during query
parts.partition_auto_increment_archive : MDEV-16491 - Table marked as crashed
parts.partition_auto_increment_maria : MDEV-14430 - Wrong result
-parts.partition_debug : Modified in 10.1.42
-parts.partition_debug_innodb : Modified in 10.1.42
-parts.partition_debug_myisam : Modified in 10.1.42
parts.partition_exch_qa_10 : MDEV-11765 - wrong result
parts.partition_innodb_status_file : MDEV-12901 - Valgrind
-parts.reorganize_partition_innodb : Added in 10.1.42
#-----------------------------------------------------------------------
@@ -352,19 +338,19 @@ rpl.create_or_replace_mix : MDEV-20523 - Wrong result
rpl.create_or_replace_statement : MDEV-20523 - Wrong result
rpl.create_select : MDEV-14121 - Assertion failure
rpl.last_insert_id : MDEV-10625 - warnings in error log
-rpl.mdev_17588 : Modified in 10.1.42
rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips
rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips
rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log
rpl.rpl_binlog_index : MDEV-9501 - Warning: failed registering on master
rpl.rpl_colSize : MDEV-16112 - Server crash
+rpl.rpl_conditional_comments : Modified in 10.1.45
rpl.rpl_corruption : Include file modified in 10.1.44
-rpl.rpl_create_or_replace_fail : Added in 10.1.42
rpl.rpl_ddl : MDEV-10417 - Fails on Mips
rpl.rpl_domain_id_filter_io_crash : MDEV-14357 - Wrong result
rpl.rpl_domain_id_filter_master_crash : MDEV-19043 - Warnings/errors
rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result; MDEV-19043 - Warnings/errors
rpl.rpl_drop_db_fail : MDEV-16898 - Slave fails to start
+rpl.rpl_fail_register : Added in 10.1.45
rpl.rpl_get_lock : MDEV-19368 - mysqltest failed but provided no output
rpl.rpl_gtid_basic : MDEV-10681 - server startup problem
rpl.rpl_gtid_crash : MDEV-9501 - Warning: failed registering on master
@@ -380,14 +366,11 @@ rpl.rpl_insert_id : MDEV-15197 - Wrong result
rpl.rpl_insert_id_pk : MDEV-16567 - Assertion failure
rpl.rpl_insert_ignore : MDEV-14365 - Lost connection to MySQL server during query
rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips
-rpl.rpl_known_bugs_detection : Modified in 10.1.42
rpl.rpl_mariadb_slave_capability : MDEV-11018 - sporadic wrong events in binlog
rpl.rpl_mdev12179 : MDEV-19043 - Warnings/errors
rpl.rpl_mdev6020 : MDEV-10417 - Fails on Mips
-rpl.rpl_mdev_17614 : Added in 10.1.42
rpl.rpl_non_direct_row_mixing_engines : MDEV-16561 - Timeout in master pos wait
rpl.rpl_parallel : MDEV-10653 - Timeouts
-rpl.rpl_parallel_ignored_errors : Added in 10.1.42
rpl.rpl_parallel_mdev6589 : MDEV-12979 - Assertion failure
rpl.rpl_parallel_multilevel2 : MDEV-14723 - Timeout
rpl.rpl_parallel_optimistic : MDEV-10511 - Timeout
@@ -416,12 +399,10 @@ rpl.rpl_slave_grp_exec : MDEV-10514 - Unexpected deadlock
rpl.rpl_start_stop_slave : MDEV-13567 - Replication failure
rpl.rpl_stm_relay_ign_space : MDEV-14360 - Test assertion
rpl.rpl_sync : MDEV-10633 - Database page corruption
-rpl.rpl_sync_with_innodb_thd_conc : Added in 10.1.42
rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries
rpl.rpl_test_framework : MDEV-19368 - mysqltest failed but provided no output
rpl.rpl_trigger : MDEV-18055 - Wrong result
rpl.rpl_truncate_3innodb : MDEV-19454 - Syntax error in test
-rpl.rpl_unsafe_statements : Modified in 10.1.42
rpl.rpl_user_variables : MDEV-20522 - Wrong result
rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result
@@ -467,7 +448,6 @@ stress.ddl_innodb : MDEV-10635 - Testcase timeout
#-----------------------------------------------------------------------
sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x
-sys_vars.delayed_insert_limit_func : Modified in 10.1.42
sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout
sys_vars.log_slow_admin_statements_func : MDEV-12235 - Server crash
sys_vars.rpl_init_slave_func : MDEV-10149 - wrong results
@@ -510,10 +490,6 @@ tokudb_bugs.xa : MDEV-11804 - Lock wait timeout
#-----------------------------------------------------------------------
-tokudb_parts.partition_debug_tokudb : Include file modified in 10.1.42
-
-#-----------------------------------------------------------------------
-
tokudb_rpl.* : MDEV-11001 - tests don't work
#-----------------------------------------------------------------------
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 1dbed8c55d1..c092faa986b 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -5037,10 +5037,19 @@ bool Lock_tables_prelocking_strategy::
handle_table(THD *thd, Query_tables_list *prelocking_ctx,
TABLE_LIST *table_list, bool *need_prelocking)
{
+ TABLE_LIST **last= prelocking_ctx->query_tables_last;
+
if (DML_prelocking_strategy::handle_table(thd, prelocking_ctx, table_list,
need_prelocking))
return TRUE;
+ /*
+ normally we don't need to open FK-prelocked tables for RESTRICT,
+ MDL is enough. But under LOCK TABLES we have to open everything
+ */
+ for (TABLE_LIST *tl= *last; tl; tl= tl->next_global)
+ tl->open_strategy= TABLE_LIST::OPEN_NORMAL;
+
/* We rely on a caller to check that table is going to be changed. */
DBUG_ASSERT(table_list->lock_type >= TL_WRITE_ALLOW_WRITE);
diff --git a/sql/table.h b/sql/table.h
index 44803b5aacd..29b4cfdbcf3 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1813,6 +1813,9 @@ struct TABLE_LIST
open_type= routine ? OT_TEMPORARY_OR_BASE : OT_BASE_ONLY;
belong_to_view= belong_to_view_arg;
trg_event_map= trg_event_map_arg;
+ /* MDL is enough for read-only FK checks, we don't need the table */
+ if (prelocking_placeholder == FK && lock_type < TL_WRITE_ALLOW_WRITE)
+ open_strategy= OPEN_STUB;
**last_ptr= this;
prev_global= *last_ptr;