mariadb/mysql-test/suite/innodb/t/alter_missing_tablespace.test
Marko Mäkelä e581396b7a MDEV-29983 Deprecate innodb_file_per_table
Before commit 6112853cda in MySQL 4.1.1
introduced the parameter innodb_file_per_table, all InnoDB data was
written to the InnoDB system tablespace (often named ibdata1).
A serious design problem is that once the system tablespace has grown to
some size, it cannot shrink even if the data inside it has been deleted.

There are also other design problems, such as the server hang MDEV-29930
that should only be possible when using innodb_file_per_table=0 and
innodb_undo_tablespaces=0 (storing both tables and undo logs in the
InnoDB system tablespace).

The parameter innodb_change_buffering was deprecated
in commit b5852ffbee.
Starting with commit baf276e6d4
(MDEV-19229) the number of innodb_undo_tablespaces can be increased,
so that the undo logs can be moved out of the system tablespace
of an existing installation.

If all these things (tables, undo logs, and the change buffer) are
removed from the InnoDB system tablespace, the only variable-size
data structure inside it is the InnoDB data dictionary.

DDL operations on .ibd files was optimized in
commit 86dc7b4d4c (MDEV-24626).
That should have removed any thinkable performance advantage of
using innodb_file_per_table=0.

Since there should be no benefit of setting innodb_file_per_table=0,
the parameter should be deprecated. Starting with MySQL 5.6 and
MariaDB Server 10.0, the default value is innodb_file_per_table=1.
2023-01-11 17:55:56 +02:00

75 lines
2.7 KiB
Text

--source include/not_embedded.inc
--source include/innodb_page_size.inc
--source include/no_valgrind_without_big.inc
--echo #
--echo # Bug#13955083 ALLOW IN-PLACE DDL OPERATIONS ON MISSING
--echo # OR DISCARDED TABLESPACES
--echo #
--disable_query_log
call mtr.add_suppression("InnoDB: Cannot open datafile for read-only: ");
call mtr.add_suppression("InnoDB: Operating system error number .* in a file operation");
call mtr.add_suppression("InnoDB: Error number \\d+ means");
call mtr.add_suppression("InnoDB: Ignoring tablespace for test/\(t\|x@002e@002ed\) because it could not be opened");
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing");
call mtr.add_suppression("Could not find a valid tablespace file for");
call mtr.add_suppression("InnoDB: Failed to find tablespace for table `test`\.`\(t\|x\.\.d\)` in the cache");
call mtr.add_suppression("InnoDB: Cannot delete tablespace [0-9]+.*not found");
call mtr.add_suppression("Table .* in the InnoDB data dictionary has tablespace id .*, but tablespace with that id or name does not exist");
call mtr.add_suppression("InnoDB: ALTER TABLE `test`.`t` DISCARD TABLESPACE failed to find tablespace");
--enable_query_log
let $MYSQLD_DATADIR=`select @@datadir`;
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
# Remove the tablespace files.
--remove_file $MYSQLD_DATADIR/test/t.ibd
--remove_file $MYSQLD_DATADIR/test/x@002e@002ed.ibd
--source include/start_mysqld.inc
# The table does exist, only the tablespace does not exist.
--error ER_GET_ERRNO
SELECT * FROM t;
--error ER_GET_ERRNO
ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE;
SHOW WARNINGS;
--error ER_GET_ERRNO
ALTER TABLE t ADD INDEX (a), ALGORITHM=COPY;
SHOW WARNINGS;
--error ER_GET_ERRNO
ALTER TABLE t AUTO_INCREMENT=1, ALGORITHM=INPLACE;
--error ER_GET_ERRNO
ALTER TABLE t AUTO_INCREMENT=1, ALGORITHM=COPY;
--error ER_PARSE_ERROR
ALTER TABLE t ALGORITHM=INPLACE, DISCARD TABLESPACE;
--error ER_PARSE_ERROR
ALTER TABLE t ALGORITHM=COPY, DISCARD TABLESPACE;
--error ER_PARSE_ERROR
ALTER TABLE t ALGORITHM=DEFAULT, DISCARD TABLESPACE;
ALTER TABLE t DISCARD TABLESPACE;
RENAME TABLE t TO u;
RENAME TABLE u TO v;
DROP TABLE v;
--error ER_GET_ERRNO
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;