Debian Codegraph @

mysql-test/suite/innodb/t/alter_kill.test

raw
1 -- source include/no_valgrind_without_big.inc
2
3 # Temporarily skipping the test when log-bin is enabled due to Bug#22292900
4 --source include/not_log_bin.inc
5
6 let MYSQLD_DATADIR=`select @@datadir`;
7 let PAGE_SIZE=`select @@innodb_page_size`;
8
9 -- disable_query_log
10 call mtr.add_suppression("innodb_force_recovery is on.");
11 call mtr.add_suppression("Tablespace open failed for.*bug16720368");
12 call mtr.add_suppression("Failed to find tablespace.*bug16720368");
13 call mtr.add_suppression("Header page contains inconsistent data in .*bug16720368.ibd");
14 call mtr.add_suppression("Corrupted page.*could not be found in the doublewrite buffer");
15 call mtr.add_suppression("Could not find.*test/bug16720368");
16 call mtr.add_suppression(".*test.*bug16720368.*missing");
17 call mtr.add_suppression("Ignoring tablespace `test/bug16720368` because it could not be opened");
18 call mtr.add_suppression("Found 1 prepared XA transactions");
19 call mtr.add_suppression("Operating system error.*in a file operation");
20 call mtr.add_suppression("Error number 22 means 'Invalid argument'");
21 call mtr.add_suppression("\(The error means\|If you are\)");
22 call mtr.add_suppression("Skip re-populating collations and character sets tables in InnoDB read-only mode.");
23 call mtr.add_suppression("Error number [0-9]* means 'Resource temporarily unavailable'");
24 call mtr.add_suppression("Skip updating information_schema metadata in InnoDB read-only mode.");
25 call mtr.add_suppression(".*MY-\d+.* Tablespace [0-9]+, name 'test.*bug16720368', unable to open file '.*test.*bug16720368.ibd' - Data structure corruption");
26 call mtr.add_suppression("Skipped updating resource group metadata in InnoDB read only mode.");
27 -- enable_query_log
28
29 -- echo #
30 -- echo # Bug#16720368 INNODB CRASHES ON BROKEN #SQL*.IBD FILE AT STARTUP
31 -- echo #
32
33 SET GLOBAL innodb_file_per_table=1;
34
35 CREATE TABLE bug16720368_1 (a INT PRIMARY KEY) ENGINE=InnoDB;
36
37 connect (con1,localhost,root);
38 CREATE TABLE bug16720368 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
39 INSERT INTO bug16720368 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8);
40
41 connection default;
42
43 -- echo # Cleanly shutdown mysqld
44 -- source include/shutdown_mysqld.inc
45
46 disconnect con1;
47
48 -- echo # Corrupt FIL_PAGE_OFFSET in bug16720368.ibd,
49 -- echo # and update the checksum to the "don't care" value.
50 perl;
51 my $file = "$ENV{MYSQLD_DATADIR}/test/bug16720368.ibd";
52 open(FILE, "+<$file") || die "Unable to open $file";
53 print FILE pack("H*","deadbeefc001cafe") || die "Unable to write $file";
54 seek(FILE, $ENV{PAGE_SIZE}-8, 0) || die "Unable to seek $file";
55 print FILE pack("H*","deadbeef") || die "Unable to write $file";
56 close(FILE) || die "Unable to close $file";
57 EOF
58
59 -- echo # Restart mysqld
60 -- source include/start_mysqld.inc
61
62 -- echo # This will succeed after a clean shutdown, due to
63 -- echo # fil_open_single_table_tablespace(check_space_id=FALSE).
64 SELECT COUNT(*) FROM bug16720368;
65
66 INSERT INTO bug16720368_1 VALUES(1);
67
68 -- source include/kill_and_restart_mysqld.inc
69
70 -- echo # The table is unaccessible, because after a crash we will
71 -- echo # validate the tablespace header.
72 --error ER_TABLESPACE_MISSING
73 SELECT COUNT(*) FROM bug16720368;
74 --error ER_TABLESPACE_MISSING
75 INSERT INTO bug16720368 VALUES(0,1);
76
77 let $restart_parameters = restart: --innodb-force-recovery=3;
78 -- source include/kill_and_restart_mysqld.inc
79
80 -- echo # The table is readable thanks to innodb-force-recovery.
81 SELECT COUNT(*) FROM bug16720368;
82 --error ER_INNODB_FORCED_RECOVERY
83 INSERT INTO bug16720368 VALUES(0,1);
84
85 -- echo # Shut down the server cleanly to hide the corruption.
86 let $restart_parameters = restart;
87 -- source include/restart_mysqld.inc
88
89 -- echo # The table is accessible, because after a clean shutdown we will
90 -- echo # NOT validate the tablespace header.
91 -- echo # We can modify the existing pages, but we cannot allocate or free
92 -- echo # any pages, because that would hit the corruption on page 0.
93 SELECT COUNT(*) FROM bug16720368;
94 INSERT INTO bug16720368 VALUES(0,1);
95
96 -- echo # Shut down the server to uncorrupt the data.
97 -- source include/shutdown_mysqld.inc
98
99 # Uncorrupt the FIL_PAGE_OFFSET.
100 perl;
101 my $file = "$ENV{MYSQLD_DATADIR}/test/bug16720368.ibd";
102 open(FILE, "+<$file") || die "Unable to open $file";
103 # Uncorrupt FIL_PAGE_OFFSET.
104 print FILE pack("H*","deadbeef00000000") || die "Unable to write $file";
105 close(FILE) || die "Unable to close $file";
106 EOF
107
108 -- echo # Restart the server after uncorrupting the file.
109 -- source include/start_mysqld.inc
110
111 INSERT INTO bug16720368 VALUES(9,1);
112 SELECT COUNT(*) FROM bug16720368;
113
114 DROP TABLE bug16720368, bug16720368_1;
115
116 -- echo #
117 -- echo # Bug#16735660 ASSERT TABLE2 == NULL, ROLLBACK OF RESURRECTED TXNS,
118 -- echo # DICT_TABLE_ADD_TO_CACHE
119 -- echo #
120
121 SET GLOBAL innodb_file_per_table=1;
122
123 CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
124 BEGIN;
125 INSERT INTO t1 VALUES(42);
126
127 -- connect (con1,localhost,root)
128
129 CREATE TABLE bug16735660 (a INT PRIMARY KEY) ENGINE=InnoDB;
130
131 XA START 'x';
132 INSERT INTO bug16735660 VALUES(1),(2),(3);
133 XA END 'x';
134 XA PREPARE 'x';
135
136 -- connection default
137
138 -- source include/kill_mysqld.inc
139 -- disconnect con1
140
141 -- move_file $MYSQLD_DATADIR/test/bug16735660.ibd $MYSQLD_DATADIR/bug16735660.omg
142
143 -- echo # Attempt to start without an *.ibd file.
144 let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
145 -- error 1,42
146 -- exec $MYSQLD_CMD --core-file --console > $SEARCH_FILE 2>&1;
147
148 let SEARCH_PATTERN= \[ERROR\].*Could not find any file associated with the tablespace ID:.*;
149 -- source include/search_pattern.inc
150
151 -- move_file $MYSQLD_DATADIR/bug16735660.omg $MYSQLD_DATADIR/test/bug16735660.ibd
152
153 -- source include/start_mysqld.inc
154
155 SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
156 SELECT * FROM bug16735660;
157
158 XA RECOVER;
159 XA ROLLBACK 'x';
160
161 SELECT * FROM bug16735660;
162 DROP TABLE bug16735660;