mirror of
https://github.com/MariaDB/server.git
synced 2025-11-09 11:41:36 +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.
83 lines
2.2 KiB
Plaintext
83 lines
2.2 KiB
Plaintext
#
|
|
# Test opening a corrupted table.
|
|
#
|
|
# Restarting is not supported under embedded
|
|
-- source include/not_embedded.inc
|
|
# Require InnoDB
|
|
-- source include/have_innodb.inc
|
|
-- source include/not_encrypted.inc
|
|
|
|
--disable_query_log
|
|
call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted\\. Please drop the table and recreate\\.");
|
|
call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*test.t1\\.ibd' page");
|
|
call mtr.add_suppression("InnoDB: We detected index corruption in an InnoDB type table");
|
|
call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it");
|
|
call mtr.add_suppression("InnoDB: File '.*test/t1\\.ibd' is corrupted");
|
|
--enable_query_log
|
|
|
|
--echo # Ensure that purge will not crash on the table after we corrupt it.
|
|
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
|
|
SET GLOBAL innodb_fast_shutdown=0;
|
|
|
|
--echo # Create and populate the table to be corrupted
|
|
|
|
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
|
|
INSERT INTO t1 (b) VALUES ('corrupt me');
|
|
--disable_query_log
|
|
--let $i = 10
|
|
while ($i)
|
|
{
|
|
INSERT INTO t1 (b) VALUES (REPEAT('abcdefghijklmnopqrstuvwxyz', 100));
|
|
dec $i;
|
|
}
|
|
--enable_query_log
|
|
INSERT INTO t1 (b) VALUES ('corrupt me');
|
|
|
|
let $MYSQLD_DATADIR=`select @@datadir`;
|
|
let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
|
|
|
|
--source include/shutdown_mysqld.inc
|
|
|
|
--echo # Corrupt the table
|
|
|
|
perl;
|
|
use strict;
|
|
use warnings;
|
|
use Fcntl qw(:DEFAULT :seek);
|
|
|
|
my $ibd_file = $ENV{'t1_IBD'};
|
|
|
|
my $chunk;
|
|
my $len;
|
|
|
|
sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file";
|
|
|
|
while ($len = sysread IBD_FILE, $chunk, 1024)
|
|
{
|
|
if ($chunk =~ s/corrupt me/korrupt me/)
|
|
{
|
|
print "Munged a string.\n";
|
|
sysseek IBD_FILE, -$len, SEEK_CUR;
|
|
syswrite IBD_FILE, $chunk, $len;
|
|
}
|
|
}
|
|
|
|
close IBD_FILE;
|
|
EOF
|
|
|
|
--source include/start_mysqld.inc
|
|
|
|
--echo # Now t1 is corrupted but we should not crash
|
|
|
|
--error ER_GET_ERRNO,ER_NOT_KEYFILE,ER_INDEX_CORRUPT,ER_NO_SUCH_TABLE_IN_ENGINE
|
|
SELECT * FROM t1;
|
|
|
|
--error 126,ER_GET_ERRNO,ER_NOT_KEYFILE,ER_INDEX_CORRUPT,ER_NO_SUCH_TABLE_IN_ENGINE
|
|
INSERT INTO t1(b) VALUES('abcdef');
|
|
|
|
--error ER_GET_ERRNO,ER_NOT_KEYFILE,ER_INDEX_CORRUPT,ER_NO_SUCH_TABLE_IN_ENGINE
|
|
UPDATE t1 set b = 'deadbeef' where a = 1;
|
|
|
|
--echo # Cleanup, this must be possible
|
|
DROP TABLE t1;
|