mirror of
https://github.com/MariaDB/server.git
synced 2025-08-30 11:22:14 +03:00
In commit 1bd681c8b3
(MDEV-25506 part 3)
the way how DDL transactions delete files was rewritten.
Only files that are actually attached to InnoDB tablespaces would be
deleted, and only after the DDL transaction was durably committed.
After a failed ALTER TABLE...IMPORT TABLESPACE, any data files that
the user might have moved to the data directory will not be attached
to the InnoDB data dictionary. Therefore, DROP TABLE would not
attempt to delete those files, and a subsequent CREATE TABLE would
fail. The logic was that the user who created the files outside the
DBMS is still the owner of those files, and InnoDB should not delete
those files because an "ownership transfer" (IMPORT TABLESPACE) was
not successfully completed.
However, not deleting those detached files could surprise users.
ha_innobase::delete_table(): Even if no tablespace exists, try to
delete any files that might match the table name.
Reviewed by: Thirunarayanan Balathandayuthapani
36 lines
1.3 KiB
Plaintext
36 lines
1.3 KiB
Plaintext
--source include/have_innodb.inc
|
|
|
|
call mtr.add_suppression("Index for table 'imp_t1' is corrupt; try to repair it");
|
|
|
|
SET @save_innodb_checksum_algorithm=@@GLOBAL.innodb_checksum_algorithm;
|
|
SET GLOBAL innodb_checksum_algorithm=full_crc32;
|
|
|
|
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
|
|
CREATE TABLE imp_t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
|
ALTER TABLE imp_t1 DISCARD TABLESPACE ;
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
let $datadir=`select @@datadir`;
|
|
--copy_file $datadir/test/t1.ibd $datadir/test/imp_t1.ibd
|
|
UNLOCK TABLES;
|
|
--error ER_TABLE_SCHEMA_MISMATCH
|
|
ALTER TABLE imp_t1 IMPORT TABLESPACE;
|
|
--error ER_TABLE_EXISTS_ERROR
|
|
CREATE TABLE imp_t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
DROP TABLE imp_t1;
|
|
CREATE TABLE imp_t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
DROP TABLE imp_t1, t1;
|
|
|
|
SET GLOBAL innodb_checksum_algorithm=@save_innodb_checksum_algorithm;
|
|
|
|
--echo #
|
|
--echo # MDEV-27006 Assertion `!lock_trx_has_sys_table_locks(trx)'
|
|
--echo # failed in dberr_t row_discard_tablespace_for_mysql
|
|
--echo # (dict_table_t*, trx_t*)
|
|
CREATE TABLE t1 (c INT KEY) ENGINE=INNODB;
|
|
CREATE TABLE t2 (c INT KEY,FOREIGN KEY(c) REFERENCES t1 (c)) ENGINE=INNODB;
|
|
--error ER_ROW_IS_REFERENCED_2
|
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
|
DROP TABLE t2, t1;
|
|
|
|
--echo # End of 10.6 tests
|