1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
--echo #
--echo # Bug #20445525 ADD A CONSISTENCY CHECK AGAINST DB_TRX_ID BEING
--echo # IN THE FUTURE
--echo #
--source include/have_nodebug.inc
let PAGE_SIZE=`select @@innodb_page_size`;
CREATE TABLE t1(a INT) row_format=redundant engine=innoDB;
INSERT INTO t1 VALUES(1);
let MYSQLD_DATADIR=`select @@datadir`;
--source include/shutdown_mysqld.inc
perl;
$page_size=$ENV{PAGE_SIZE};
my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd";
open(FILE, "+<", $file) || die "Unable to open $file";
#Seek the the infimum record and get the offset to next record
#Infimum record exist at offset 101 for redundant format
#And offset to the next record is present 2 bytes prior to
#infimum record
seek(FILE, 4*$page_size+101-2, 0) || die "Unable to seek $file";
die unless read(FILE, $_, 2) == 2;
my $record_offset = unpack("n*", $_);
#In this case the first record should be at offset 135
die unless $record_offset == 135;
my $trx_id_of_rec = 4*$page_size + $record_offset + 6;
# Modify DB_TRX_ID of the record to a value which is greater than
# max_trx_id
seek(FILE, $trx_id_of_rec , 0) || die "Unable to seek $file";
my $corrupted_trx_id = "\xff" x 6;
syswrite(FILE, $corrupted_trx_id) || die "Unable to write";
#Modify the checksums of the page
seek(FILE, 4*$page_size, 0) || die "Unable to seek $file";
syswrite(FILE, pack("H*","deadbeef",4)) || die "Unable to write";
seek(FILE, 5*$page_size-8, 0) || die "Unable to seek $file";
syswrite(FILE, pack("H*","deadbeef",4)) || die "Unable to write";
close(FILE)
EOF
--source include/start_mysqld.inc
--disable_query_log
call mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* A transaction id in a record of table `\.\.*`\.`\.\.*` is newer than the system-wide maximum.");
--enable_query_log
SELECT * FROM t1;
DROP TABLE t1;
|