mirror of
https://github.com/MariaDB/server.git
synced 2025-11-10 23:02:54 +03:00
Before commit6112853cdain 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 commitb5852ffbee. Starting with commitbaf276e6d4(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 commit86dc7b4d4c(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.
95 lines
3.5 KiB
Plaintext
95 lines
3.5 KiB
Plaintext
FLUSH TABLES;
|
|
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
# restart
|
|
CREATE TABLE t3(a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
BEGIN;
|
|
INSERT INTO t3 VALUES (33101),(347);
|
|
INSERT INTO t1 VALUES (42),(9),(101);
|
|
RENAME TABLE t1 TO t2;
|
|
UPDATE t2 SET a=347 where a=42;
|
|
COMMIT;
|
|
# Kill the server
|
|
# Fault 0 (no real fault): Orphan file with duplicate space_id.
|
|
# Fault 1: Two dirty files with the same space_id.
|
|
# restart
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
FOUND 1 /InnoDB: Ignoring data file '.*t2.ibd' with space ID \d+. Another data file called .*t1.ibd exists with the same space ID/ in mysqld.1.err
|
|
# Fault 2: Wrong space_id in a dirty file, and a missing file.
|
|
# restart
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
FOUND 1 /InnoDB: Tablespace \d+ was not found at.*t3.ibd/ in mysqld.1.err
|
|
# Fault 3: Wrong space_id in a dirty file, and no missing file.
|
|
# restart
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
FOUND 1 /InnoDB: Ignoring data file '.*t[23].ibd' with space ID/ in mysqld.1.err
|
|
NOT FOUND /InnoDB: Tablespace \d+ was not found at .*t1.ibd/ in mysqld.1.err
|
|
FOUND 1 /InnoDB: Tablespace \d+ was not found at .*t3.ibd/ in mysqld.1.err
|
|
FOUND 2 /InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace/ in mysqld.1.err
|
|
# Fault 4: Missing data file
|
|
# restart
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
FOUND 1 /InnoDB: Tablespace \d+ was not found at .*t[12].ibd.
|
|
.*InnoDB: Set innodb_force_recovery=1 to ignore this and to permanently lose all changes to the tablespace/ in mysqld.1.err
|
|
# Fault 5: Wrong type of data file
|
|
# restart
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
# restart
|
|
SELECT * FROM INFORMATION_SCHEMA.ENGINES
|
|
WHERE engine = 'innodb'
|
|
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
|
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
|
|
NOT FOUND /\[Note\] InnoDB: Cannot read first page of .*t2.ibd/ in mysqld.1.err
|
|
FOUND 1 /.*\[ERROR\] InnoDB: Cannot apply log to \[page id: space=[1-9][0-9]*, page number=3\] of corrupted file './test/t2\.ibd'/ in mysqld.1.err
|
|
# restart
|
|
SELECT * FROM t2;
|
|
a
|
|
9
|
|
101
|
|
347
|
|
SELECT * FROM t3;
|
|
a
|
|
347
|
|
33101
|
|
SHOW TABLES;
|
|
Tables_in_test
|
|
t2
|
|
t3
|
|
DROP TABLE t2,t3;
|
|
CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
ERROR HY000: Can't create table `test`.`t0` (errno: 184 "Tablespace already exists")
|
|
CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
ERROR HY000: Can't create table `test`.`t0` (errno: 184 "Tablespace already exists")
|
|
CREATE TABLE t0(a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
DROP TABLE t0;
|
|
CREATE TABLE u1(a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
CREATE TABLE u2(a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
CREATE TABLE u3(a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
CREATE TABLE u4(a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
INSERT INTO u4 VALUES(1);
|
|
RENAME TABLE u4 TO u5;
|
|
RENAME TABLE u5 TO u6;
|
|
INSERT INTO u6 VALUES(2);
|
|
# Kill the server
|
|
# Fault 6: All-zero data file and innodb_force_recovery
|
|
# restart: --innodb-force-recovery=1
|
|
DROP TABLE u1,u2,u3,u6;
|
|
# List of files:
|
|
db.opt
|
|
SHOW TABLES;
|
|
Tables_in_test
|