mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
MDEV-16145 Crash in ALTER TABLE…AUTO_INCREMENT=1 after DISCARD TABLESPACE
This is the MariaDB equivalent of fixing the MySQL 5.7 regression Bug #26935001 ALTER TABLE AUTO_INCREMENT TRIES TO READ INDEX FROM DISCARDED TABLESPACE Oracle did not publish a test case, but it is easy to guess based on the commit message. The MariaDB code is different due to MDEV-6076 implementing persistent AUTO_INCREMENT. commit_set_autoinc(): Report ER_TABLESPACE_DISCARDED if the tablespace is missing. prepare_inplace_alter_table_dict(): Avoid accessing a discarded tablespace. (This avoids generating warnings in fil_space_acquire().)
This commit is contained in:
@@ -21,8 +21,10 @@ call mtr.add_suppression("Table .* in the InnoDB data dictionary has tablespace
|
||||
|
||||
let $MYSQLD_DATADIR=`select @@datadir`;
|
||||
SET GLOBAL innodb_file_per_table=1;
|
||||
CREATE TABLE t(a INT)ENGINE=InnoDB;
|
||||
CREATE TABLE t(a SERIAL)ENGINE=InnoDB;
|
||||
CREATE TABLE `x..d` (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t1(a SERIAL)ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(1),(2),(3);
|
||||
|
||||
--source include/shutdown_mysqld.inc
|
||||
|
||||
@@ -41,10 +43,15 @@ SELECT * FROM t;
|
||||
ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE;
|
||||
SHOW WARNINGS;
|
||||
|
||||
--error ER_NO_SUCH_TABLE
|
||||
ALTER TABLE t1 ADD INDEX (a), ALGORITHM=COPY;
|
||||
--error ER_NO_SUCH_TABLE_IN_ENGINE
|
||||
ALTER TABLE t ADD INDEX (a), ALGORITHM=COPY;
|
||||
SHOW WARNINGS;
|
||||
|
||||
--error ER_NO_SUCH_TABLE_IN_ENGINE
|
||||
ALTER TABLE t AUTO_INCREMENT=1, ALGORITHM=INPLACE;
|
||||
--error ER_NO_SUCH_TABLE_IN_ENGINE
|
||||
ALTER TABLE t AUTO_INCREMENT=1, ALGORITHM=COPY;
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
ALTER TABLE t ALGORITHM=INPLACE, DISCARD TABLESPACE;
|
||||
--error ER_PARSE_ERROR
|
||||
@@ -56,3 +63,12 @@ DROP TABLE t;
|
||||
--error ER_NO_SUCH_TABLE_IN_ENGINE
|
||||
SELECT * FROM `x..d`;
|
||||
DROP TABLE `x..d`;
|
||||
|
||||
ALTER TABLE t1 DISCARD TABLESPACE;
|
||||
--error ER_TABLESPACE_DISCARDED
|
||||
ALTER TABLE t1 AUTO_INCREMENT=1, ALGORITHM=INPLACE;
|
||||
--error ER_TABLESPACE_DISCARDED
|
||||
ALTER TABLE t1 AUTO_INCREMENT=1, FORCE, ALGORITHM=INPLACE;
|
||||
--error ER_TABLESPACE_DISCARDED
|
||||
ALTER TABLE t1 AUTO_INCREMENT=1, ALGORITHM=COPY;
|
||||
DROP TABLE t1;
|
||||
|
||||
Reference in New Issue
Block a user