summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t/trx_id_future.test
blob: 391650c13d49171cd134e4db2fa6821b7f7e5cc9 (plain)
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
64
65
66
67
68
69
70
--echo #
--echo # Bug #20445525	ADD A CONSISTENCY CHECK AGAINST DB_TRX_ID BEING
--echo #		IN THE FUTURE
--echo #

--source include/not_debug.inc
--source include/have_innodb.inc
--source include/not_embedded.inc

SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
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/wait_all_purged.inc
let $restart_noprint=2;
--source include/shutdown_mysqld.inc

perl;
do "$ENV{MTR_SUITE_DIR}/include/crc32.pl";
my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd";
open(FILE, "+<", $file) || die "Unable to open $file";
binmode 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

my $ps= $ENV{PAGE_SIZE};
my $page;
die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps;
my $full_crc32 = unpack("N",substr($page,54,4)) & 0x10; # FIL_SPACE_FLAGS
sysseek(FILE, 3*$ps, 0) || die "Unable to seek $file\n";
die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps;
#In this case the first record should be at offset 135
die unless unpack("n", substr($page, 99, 2)) == 135;

substr($page,135+6,6) = "\xff" x 6;

my $polynomial = 0x82f63b78; # CRC-32C
if ($full_crc32)
{
    my $ck = mycrc32(substr($page, 0, $ps - 4), 0, $polynomial);
    substr($page, $ps - 4, 4) = pack("N", $ck);
}
else
{
    my $ck= pack("N",mycrc32(substr($page, 4, 22), 0, $polynomial) ^
		 mycrc32(substr($page, 38, $ps - 38 - 8), 0, $polynomial));
    substr($page,0,4)=$ck;
    substr($page,$ps-8,4)=$ck;
}
sysseek(FILE, 3*$ps, 0) || die "Unable to rewind $file\n";
syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n";
close(FILE) || die "Unable to close $file";
EOF

--source include/start_mysqld.inc

let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN= \[Warning\] InnoDB: A transaction id in a record of table `test`\.`t1` is newer than the system-wide maximum;
--source include/search_pattern_in_file.inc

call mtr.add_suppression("\\[Warning\\] InnoDB: A transaction id in a record of table `test`\\.`t1` is newer than the system-wide maximum");

SELECT * FROM t1;
DROP TABLE t1;