| 1 |
# In old versions that wrote garbage into files, the page size was 16k. |
| 2 |
|
| 3 |
--echo # |
| 4 |
--echo # Bug#20691930 5.7.6 CRASH WHEN RUNNING MYSQL_UPGRADE |
| 5 |
--echo # AFTER BINARY UPGRADE |
| 6 |
--echo # |
| 7 |
|
| 8 |
CREATE TABLE t (a int primary key, b char(255) not null default '', index(b)) |
| 9 |
ENGINE=InnoDB; |
| 10 |
|
| 11 |
INSERT t(a) VALUES(1),(2),(3),(4),(5),(6),(7),(8); |
| 12 |
let $MYSQLD_DATADIR=`select @@datadir`; |
| 13 |
let IBD_FILE=$MYSQLD_DATADIR/test/t.ibd; |
| 14 |
let IBD_PAGE_SIZE=`select @@innodb_page_size`; |
| 15 |
|
| 16 |
--source include/shutdown_mysqld.inc |
| 17 |
perl; |
| 18 |
use strict; |
| 19 |
use warnings; |
| 20 |
use Fcntl qw(:DEFAULT :seek); |
| 21 |
my $file = $ENV{IBD_FILE}; |
| 22 |
my $size = $ENV{IBD_PAGE_SIZE}; |
| 23 |
sysopen FILE, $file, O_RDWR || die "Unable to open $file: $!"; |
| 24 |
die "Unable to read $file: $!" unless sysread(FILE, $_, $size*3) == $size*3; |
| 25 |
my $ck = pack("H*", "DEADBEEF"); |
| 26 |
my $type = pack("H*", "45BF"); # FIL_PAGE_INDEX |
| 27 |
my $payload = $size-26-8; |
| 28 |
# Change each page type to FIL_PAGE_INDEX, and rewrite the checksum. |
| 29 |
s/....(.{16})(....)..(.{$payload})......../$ck.$1.$2.$type.$3.$ck.$2/ges; |
| 30 |
sysseek(FILE, 0, SEEK_SET) || die "Unable to seek $file: $!"; |
| 31 |
syswrite(FILE, $_, $size * 3) || warn "Unable to write $file: $!"; |
| 32 |
close(FILE) || die "Unable to close $file: $!"; |
| 33 |
EOF |
| 34 |
|
| 35 |
--source include/start_mysqld.inc |
| 36 |
|
| 37 |
INSERT t(a) SELECT a+8 FROM t; |
| 38 |
INSERT t(a) SELECT a+16 FROM t; |
| 39 |
INSERT t(a) SELECT a+32 FROM t; |
| 40 |
INSERT t(a) SELECT a+64 FROM t; |
| 41 |
--source include/shutdown_mysqld.inc |
| 42 |
perl; |
| 43 |
use strict; |
| 44 |
use warnings; |
| 45 |
my $file = $ENV{IBD_FILE}; |
| 46 |
my $size = $ENV{IBD_PAGE_SIZE}; |
| 47 |
open(FILE, "<$file") || die "Unable to open $file: $!"; |
| 48 |
die "Unable to read $file: $!" unless read(FILE, $_, $size*6) == $size*6; |
| 49 |
my $payload = $size-26; |
| 50 |
s/.{24}(..).{$payload}/$1/ges; |
| 51 |
print "# Page types: ", unpack("H*", $_), "\n"; |
| 52 |
close(FILE); |
| 53 |
EOF |
| 54 |
--source include/start_mysqld.inc |
| 55 |
DROP TABLE t; |