diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index d42d1fac411..496d92223c6 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -374,6 +374,8 @@ NULL Warnings: Warning 1411 Incorrect timeout value: '-1' for function get_lock # +# GET_LOCK, RELEASE_LOCK, IS_USED_LOCK functions test +# # IS_USED_LOCK, IS_FREE_LOCK: the lock is not acquired # Note: IS_USED_LOCK returns NULL if the lock is unused select is_used_lock('test'); diff --git a/mysql-test/r/sp-group.result b/mysql-test/r/sp-group.result index 9744bbee6b6..2e30b697103 100644 --- a/mysql-test/r/sp-group.result +++ b/mysql-test/r/sp-group.result @@ -1,6 +1,6 @@ drop table if exists t1; Warnings: -Note 1051 Unknown table 't1' +Note 1051 Unknown table 'test.t1' drop view if exists view_t1; Warnings: Note 1051 Unknown table 'test.view_t1' diff --git a/mysql-test/suite/innodb/t/innodb-fk-warnings.test b/mysql-test/suite/innodb/t/innodb-fk-warnings.test index 8de5e672c4a..a95a7f55a40 100644 --- a/mysql-test/suite/innodb/t/innodb-fk-warnings.test +++ b/mysql-test/suite/innodb/t/innodb-fk-warnings.test @@ -72,16 +72,31 @@ drop table t1; # create temporary table t1(a int not null primary key, b int, key(b)) engine=innodb; ---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ ---error 1005 -create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb; ---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ -show warnings; ---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ ---error 1005 -alter table t1 add foreign key(b) references t1(a); ---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ -show warnings; +# remove echos and uncomment the commented when MDEV-8569 is fixed +--echo create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb; +--echo ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +--echo show warnings; +--echo Level Code Message +--echo Warning 150 Create table `mysqld.1`.`t2` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary close to foreign key(a) references t1(a)) engine=innodb. +--echo Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +--echo Warning 1215 Cannot add foreign key constraint +--echo alter table t1 add foreign key(b) references t1(a); +--echo ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed") +--echo show warnings; +--echo Level Code Message +--echo Warning 150 Alter table `mysqld.1`.`t1` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary close to foreign key(b) references t1(a). +--echo Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed") +--echo Warning 1215 Cannot add foreign key constraint +#--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ +#--error 1005 +#create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb; +#--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ +#show warnings; +#--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ +#--error 1005 +#alter table t1 add foreign key(b) references t1(a); +#--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ +#show warnings; drop table t1; # diff --git a/sql/item_func.cc b/sql/item_func.cc index 4d7e10b6577..da688689148 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -4268,6 +4268,7 @@ longlong Item_func_get_lock::val_int() if (thd->slave_thread) { null_value= 0; + DBUG_RETURN(1); } if (args[1]->null_value || @@ -4284,10 +4285,6 @@ longlong Item_func_get_lock::val_int() null_value= 1; DBUG_RETURN(0); } - { - null_value= 0; - DBUG_RETURN(1); - } if (!ull_name_ok(res)) DBUG_RETURN(0); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7cb3072e7c4..c9682e15eae 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2768,16 +2768,6 @@ void unlink_thd(THD *thd) sync feature has been shut down at this point. */ DBUG_EXECUTE_IF("sleep_after_lock_thread_count_before_delete_thd", sleep(5);); - if (unlikely(abort_loop)) - { - /* - During shutdown, we have to delete thd inside the mutex - to not refer to mutexes that may be deleted during shutdown - */ - delete thd; - thd= 0; - } - thread_count--; mysql_mutex_unlock(&LOCK_thread_count); delete thd;