mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-22939 Server crashes in row_make_new_pathname()
The statement ALTER TABLE...DISCARD TABLESPACE is problematic, because its designed purpose is to break the referential integrity of the data dictionary and make a table point to nowhere. ha_innobase::commit_inplace_alter_table(): Check whether the table has been discarded. (This is a bit late to check it, right before committing the change.) Previously, we performed this check only in a specific branch of the function commit_set_autoinc(). Note: We intentionally allow non-rebuilding ALTER TABLE even if the tablespace has been discarded, to remain compatible with MySQL. (See the various tests with "wl5522" in the name, such as innodb.innodb-wl5522.) The test case would crash starting with 10.3 only, but it does not hurt to minimize the code and test difference between 10.2 and 10.3.
This commit is contained in:
@ -60,3 +60,13 @@ CREATE TABLE t1(a INT NOT NULL UNIQUE) ENGINE=InnoDB;
|
||||
INSERT INTO t1 SELECT * FROM seq_1_to_128;
|
||||
ALTER TABLE t1 ADD b TINYINT AUTO_INCREMENT PRIMARY KEY, DROP KEY a;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-22939 Server crashes in row_make_new_pathname()
|
||||
#
|
||||
CREATE TABLE t (a INT) ENGINE=INNODB;
|
||||
ALTER TABLE t DISCARD TABLESPACE;
|
||||
ALTER TABLE t ENGINE INNODB;
|
||||
ERROR HY000: Tablespace has been discarded for table `t`
|
||||
ALTER TABLE t FORCE;
|
||||
ERROR HY000: Tablespace has been discarded for table `t`
|
||||
DROP TABLE t;
|
||||
|
@ -68,3 +68,14 @@ CREATE TABLE t1(a INT NOT NULL UNIQUE) ENGINE=InnoDB;
|
||||
INSERT INTO t1 SELECT * FROM seq_1_to_128;
|
||||
ALTER TABLE t1 ADD b TINYINT AUTO_INCREMENT PRIMARY KEY, DROP KEY a;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-22939 Server crashes in row_make_new_pathname()
|
||||
--echo #
|
||||
CREATE TABLE t (a INT) ENGINE=INNODB;
|
||||
ALTER TABLE t DISCARD TABLESPACE;
|
||||
--error ER_TABLESPACE_DISCARDED
|
||||
ALTER TABLE t ENGINE INNODB;
|
||||
--error ER_TABLESPACE_DISCARDED
|
||||
ALTER TABLE t FORCE;
|
||||
DROP TABLE t;
|
||||
|
Reference in New Issue
Block a user