1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-29664 Assertion `!n_mysql_tables_in_use' failed in innobase_close_connection

When ha_end_bulk_insert() fails F_UNLCK was done twice: in
select_insert::prepare_eof() and in select_create::abort_result_set().

Now we avoid making F_UNLCK in prepare_eof() if error is non-zero.
This commit is contained in:
Aleksey Midenkov
2022-09-30 23:58:08 +03:00
parent d026447101
commit ba875e9396
5 changed files with 31 additions and 1 deletions

View File

@ -1,93 +0,0 @@
include/master-slave.inc
[connection master]
drop table if exists t1;
SET @old_debug= @@session.debug;
CREATE TABLE t1 (i INT, KEY(i)) ENGINE=InnoDB;
CREATE OR REPLACE TEMPORARY TABLE tmp (a int, b int, key(a)) engine=myisam;
SET debug_dbug='+d,send_kill_after_delete';
CREATE OR REPLACE TABLE t1 LIKE tmp;
SET debug_dbug=@old_debug;
SHOW TABLES;
Tables_in_test
t1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
KEY `a` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
connection slave;
SHOW TABLES;
Tables_in_test
t1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
KEY `a` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
connection master;
drop temporary table if exists tmp;
drop table t1;
include/rpl_end.inc
#
# MDEV-25292 Atomic CREATE OR REPLACE TABLE
#
set @saved_debug_dbug= @@session.debug_dbug;
create table t1 (a int primary key) engine innodb;
insert t1 values (1), (2);
create table t2 (c int, a int constraint t1_a references t1 (a)) engine innodb;
insert into t2 values (2, 2);
lock tables t2 write, t1 write;
set session debug_dbug= '+d,atomic_replace_external_lock_fail';
create or replace table t2 (y int) as select * from t1;
ERROR HY000: The total number of locks exceeds the lock table size
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c` int(11) DEFAULT NULL,
`a` int(11) DEFAULT NULL,
KEY `t1_a` (`a`),
CONSTRAINT `t1_a` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
select * from t2;
c a
2 2
unlock tables;
drop tables t2, t1;
set session debug_dbug= @saved_debug_dbug;
# Test entry_pos in higher position, so drop chain executes before create chain
# (see commit message: On linking two chains together)
create table t1 (c int);
create or replace table t1 (a int, b int, key k (a), key k (b));
ERROR 42000: Duplicate key name 'k'
create or replace table t1 (a int, b int, key k (a), key k (b));
ERROR 42000: Duplicate key name 'k'
drop table t1;
#
# MDEV-28956 Locking is broken if CREATE OR REPLACE fails under LOCK TABLES
#
# Non-atomic CREATE OR REPLACE part:
#
set @saved_debug_dbug= @@session.debug_dbug;
set @@debug_dbug="+d,ddl_log_expensive_rename";
create table t1 (pk int primary key) engine=innodb;
create or replace table t2 (a int primary key references t1 (pk)) engine=innodb;
lock tables t1 write, t2 write;
create or replace table t2 (c1 int not null, c1 varchar(255) ) engine=innodb;
ERROR 42S21: Duplicate column name 'c1'
select * from t1;
pk
select * from t2;
ERROR HY000: Table 't2' was not locked with LOCK TABLES
unlock tables;
drop tables t1;
set @@debug_dbug= @saved_debug_dbug;