diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-09-18 09:05:16 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-09-18 09:05:16 +0300 |
commit | df24f8469d31cc7eb33b4446e1450b95c12e0122 (patch) | |
tree | 1e57ff959375e00555a79fb7cef07a2590a29da5 /mysql-test/suite | |
parent | 372dba097d90e67d19da357d1bf29890489840b3 (diff) | |
download | mariadb-git-df24f8469d31cc7eb33b4446e1450b95c12e0122.tar.gz |
MDEV-12893 innodb.log_data_file_size failed in buildbot with InnoDB: Database page corruption
The purpose of the test is to ensure that redo log apply will
extend data files before applying page-level redo log records.
The test intermittently failed, because the doublewrite buffer
would sometimes contain data for the pages that the test
truncated. When the test truncates data files, it must also remove
the doublewrite buffer entries, because under normal operation, the
doublewrite buffer would only be written to if the data file already
has been extended.
Diffstat (limited to 'mysql-test/suite')
-rw-r--r-- | mysql-test/suite/innodb/t/log_data_file_size.test | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/mysql-test/suite/innodb/t/log_data_file_size.test b/mysql-test/suite/innodb/t/log_data_file_size.test index 2f1c497595b..877723a3734 100644 --- a/mysql-test/suite/innodb/t/log_data_file_size.test +++ b/mysql-test/suite/innodb/t/log_data_file_size.test @@ -24,13 +24,13 @@ use Fcntl 'SEEK_CUR', 'SEEK_END'; my $page_size = $ENV{'INNODB_PAGE_SIZE'}; my $restart; +open(FILE, "+<", "$ENV{'MYSQLD_DATADIR'}ibdata1") or die; if ($ENV{'MYSQLD_IS_DEBUG'}) { # It is impractical to ensure that CREATE TABLE t will extend ibdata1. # We rely on innodb_system_tablespace_extend_debug=1 # to recover from this fault injection if no size change was redo-logged. my $root = $ENV{'INNODB_ROOT_PAGE'}; - open(FILE, "+<", "$ENV{'MYSQLD_DATADIR'}ibdata1") or die; my $size = sysseek(FILE, 0, SEEK_END) / $page_size; seek(FILE, $page_size * ($root + 1), SEEK_SET) or die; my $empty_tail= 1; @@ -40,8 +40,22 @@ if ($ENV{'MYSQLD_IS_DEBUG'}) $restart = "--innodb-data-file-size-debug=$size"; truncate(FILE, $page_size * $root); } - close FILE; } +# Clear the doublewrite buffer entries for our tables. +sysseek(FILE, 6 * $page_size - 190, 0)||die "Unable to seek ibdata1\n"; +sysread(FILE, $_, 12) == 12||die "Unable to read TRX_SYS\n"; +my($magic,$d1,$d2)=unpack "NNN", $_; +die "magic=$magic, $d1, $d2\n" unless $magic == 536853855 && $d2 >= $d1 + 64; +sysseek(FILE, $d1 * $page_size, 0)||die "Unable to seek ibdata1\n"; +# Find the pages in the doublewrite buffer +for (my $d = $d1; $d < $d2 + 64; $d++) { + sysread(FILE, $_, $page_size)==$page_size||die "Cannot read doublewrite\n"; + my($space_id,$offset)=unpack "x[4]Nx[26]N",$_; + next unless $space_id && $offset > 3; + sysseek(FILE, $d * $page_size, 0)||die "Unable to seek ibdata1\n"; + syswrite(FILE, chr(0) x $page_size)==$page_size||die; +} +close FILE; open(FILE, ">$ENV{MYSQLTEST_VARDIR}/log/start_mysqld.txt") || die; print FILE "--let \$restart_parameters=$restart\n" if $restart; print FILE "--source include/start_mysqld.inc\n"; |