Skip to content

Commit 5a22c45

Browse files
committed
MDEV-13626: Add the test innodb.trx_id_future
1 parent adbab0d commit 5a22c45

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# Bug #20445525 ADD A CONSISTENCY CHECK AGAINST DB_TRX_ID BEING
3+
# IN THE FUTURE
4+
#
5+
CREATE TABLE t1(a INT) row_format=redundant engine=innoDB;
6+
INSERT INTO t1 VALUES(1);
7+
NOT FOUND /\[Warning\] InnoDB: A transaction id in a record of table `test`\.`t1` is newer than the system-wide maximum/ in mysqld.1.err
8+
call mtr.add_suppression("\\[Warning\\] InnoDB: A transaction id in a record of table `test`\\.`t1` is newer than the system-wide maximum");
9+
SELECT * FROM t1;
10+
a
11+
DROP TABLE t1;
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
--echo #
2+
--echo # Bug #20445525 ADD A CONSISTENCY CHECK AGAINST DB_TRX_ID BEING
3+
--echo # IN THE FUTURE
4+
--echo #
5+
6+
--source include/not_debug.inc
7+
--source include/have_innodb.inc
8+
--source include/not_embedded.inc
9+
10+
let PAGE_SIZE=`select @@innodb_page_size`;
11+
12+
CREATE TABLE t1(a INT) row_format=redundant engine=innoDB;
13+
INSERT INTO t1 VALUES(1);
14+
15+
let MYSQLD_DATADIR=`select @@datadir`;
16+
17+
--source include/shutdown_mysqld.inc
18+
19+
perl;
20+
do "$ENV{MTR_SUITE_DIR}/include/crc32.pl";
21+
my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd";
22+
open(FILE, "+<", $file) || die "Unable to open $file";
23+
binmode FILE;
24+
25+
#Seek the the infimum record and get the offset to next record
26+
#Infimum record exist at offset 101 for redundant format
27+
#And offset to the next record is present 2 bytes prior to
28+
#infimum record
29+
30+
my $ps= $ENV{PAGE_SIZE};
31+
my $page;
32+
sysseek(FILE, 3*$ps, 0) || die "Unable to seek $file\n";
33+
die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps;
34+
#In this case the first record should be at offset 135
35+
die unless unpack("n", substr($page, 99, 2)) == 135;
36+
37+
substr($page,135+6,6) = "\xff" x 6;
38+
39+
my $polynomial = 0x82f63b78; # CRC-32C
40+
my $ck= pack("N",mycrc32(substr($page, 4, 22), 0, $polynomial) ^
41+
mycrc32(substr($page, 38, $ps - 38 - 8), 0, $polynomial));
42+
substr($page,0,4)=$ck;
43+
substr($page,$ps-8,4)=$ck;
44+
sysseek(FILE, 3*$ps, 0) || die "Unable to rewind $file\n";
45+
syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n";
46+
close(FILE) || die "Unable to close $file";
47+
EOF
48+
49+
--source include/start_mysqld.inc
50+
51+
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
52+
let SEARCH_PATTERN= \[Warning\] InnoDB: A transaction id in a record of table `test`\.`t1` is newer than the system-wide maximum;
53+
--source include/search_pattern_in_file.inc
54+
55+
call mtr.add_suppression("\\[Warning\\] InnoDB: A transaction id in a record of table `test`\\.`t1` is newer than the system-wide maximum");
56+
57+
SELECT * FROM t1;
58+
DROP TABLE t1;

0 commit comments

Comments
 (0)