| 1 |
--echo # |
| 2 |
--echo # Bug #17335427 INNODB CAN NOT USE THE DOUBLEWRITE BUFFER PROPERLY |
| 3 |
--echo # Bug #18144349 INNODB CANNOT USE THE DOUBLEWRITE BUFFER FOR THE FIRST |
| 4 |
--echo # PAGE OF SYSTEM TABLESPACE |
| 5 |
--echo # |
| 6 |
|
| 7 |
--source include/not_valgrind.inc |
| 8 |
--source include/have_debug.inc |
| 9 |
|
| 10 |
# Slow shutdown and restart to make sure ibuf merge is finished |
| 11 |
SET GLOBAL innodb_fast_shutdown = 0; |
| 12 |
--source include/restart_mysqld.inc |
| 13 |
|
| 14 |
--disable_query_log |
| 15 |
call mtr.add_suppression("Database page [0-9]+:1 contained only zeroes."); |
| 16 |
call mtr.add_suppression("Header page consists of zero bytes"); |
| 17 |
call mtr.add_suppression("Checksum mismatch in datafile"); |
| 18 |
call mtr.add_suppression("but the innodb_page_size start-up parameter is"); |
| 19 |
call mtr.add_suppression("Database page corruption"); |
| 20 |
call mtr.add_suppression("Wrong server version"); |
| 21 |
--enable_query_log |
| 22 |
|
| 23 |
let INNODB_PAGE_SIZE=`select @@innodb_page_size`; |
| 24 |
let MYSQLD_DATADIR=`select @@datadir`; |
| 25 |
|
| 26 |
SHOW VARIABLES LIKE 'innodb_doublewrite'; |
| 27 |
SHOW VARIABLES LIKE 'innodb_fil_make_page_dirty_debug'; |
| 28 |
SHOW VARIABLES LIKE 'innodb_saved_page_number_debug'; |
| 29 |
|
| 30 |
create table t1 (f1 int primary key, f2 blob) engine=innodb; |
| 31 |
|
| 32 |
START TRANSACTION; |
| 33 |
INSERT INTO t1 VALUES(1, repeat('#',12)); |
| 34 |
INSERT INTO t1 VALUES(2, repeat('+',12)); |
| 35 |
INSERT INTO t1 VALUES(3, repeat('/',12)); |
| 36 |
INSERT INTO t1 VALUES(4, repeat('-',12)); |
| 37 |
INSERT INTO t1 VALUES(5, repeat('.',12)); |
| 38 |
COMMIT WORK; |
| 39 |
|
| 40 |
--echo # --------------------------------------------------------------- |
| 41 |
--echo # Test Begin: Test if recovery works if first page of user |
| 42 |
--echo # tablespace is full of zeroes. |
| 43 |
|
| 44 |
--echo # Wait for purge to complete |
| 45 |
--source include/wait_innodb_all_purged.inc |
| 46 |
|
| 47 |
--echo # Ensure that dirty pages of table t1 is flushed. |
| 48 |
FLUSH TABLES t1 FOR EXPORT; |
| 49 |
UNLOCK TABLES; |
| 50 |
|
| 51 |
SELECT space FROM INFORMATION_SCHEMA.INNODB_TABLESPACEs |
| 52 |
WHERE name = 'test/t1' INTO @space_id; |
| 53 |
|
| 54 |
SET GLOBAL innodb_checkpoint_disabled=1; |
| 55 |
|
| 56 |
BEGIN; |
| 57 |
INSERT INTO t1 VALUES (6, repeat('%', 12)); |
| 58 |
|
| 59 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 60 |
|
| 61 |
--echo # Make the first page dirty for table t1 |
| 62 |
SET GLOBAL innodb_saved_page_number_debug = 0; |
| 63 |
|
| 64 |
# Set the page dirty and force a flush to disk |
| 65 |
--source include/expect_crash.inc |
| 66 |
--error CR_SERVER_LOST |
| 67 |
SET GLOBAL innodb_fil_make_page_dirty_debug = @space_id; |
| 68 |
|
| 69 |
--echo # Make the first page (page_no=0) of the user tablespace |
| 70 |
--echo # full of zeroes. |
| 71 |
--let IBD_FILE=$MYSQLD_DATADIR/test/t1.ibd |
| 72 |
--let PAGE_NUM="0" |
| 73 |
--let ALL_ZEROES=1 |
| 74 |
--source ../include/corrupt_page.inc |
| 75 |
|
| 76 |
--source include/start_mysqld.inc |
| 77 |
|
| 78 |
CHECK TABLE t1; |
| 79 |
SELECT f1, f2 FROM t1; |
| 80 |
|
| 81 |
--echo # Test End |
| 82 |
--echo # --------------------------------------------------------------- |
| 83 |
--echo # Test Begin: Test if recovery works if first page of user |
| 84 |
--echo # tablespace is corrupted. |
| 85 |
|
| 86 |
SELECT space from INFORMATION_SCHEMA.INNODB_TABLESPACES |
| 87 |
WHERE name = 'test/t1' INTO @space_id; |
| 88 |
|
| 89 |
--echo # Ensure that dirty pages of table t1 is flushed. |
| 90 |
FLUSH TABLES t1 FOR EXPORT; |
| 91 |
UNLOCK TABLES; |
| 92 |
|
| 93 |
SET GLOBAL innodb_checkpoint_disabled=1; |
| 94 |
|
| 95 |
BEGIN; |
| 96 |
INSERT INTO t1 VALUES (6, repeat('%', 12)); |
| 97 |
|
| 98 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 99 |
|
| 100 |
--echo # Make the first page dirty for table t1 |
| 101 |
SET GLOBAL innodb_saved_page_number_debug = 0; |
| 102 |
|
| 103 |
# Set the page dirty and force a flush to disk |
| 104 |
--source include/expect_crash.inc |
| 105 |
--error CR_SERVER_LOST |
| 106 |
SET GLOBAL innodb_fil_make_page_dirty_debug = @space_id; |
| 107 |
|
| 108 |
--echo # Corrupt the first page (page_no=0) of the user tablespace. |
| 109 |
--let IBD_FILE=$MYSQLD_DATADIR/test/t1.ibd |
| 110 |
--let PAGE_NUM="0" |
| 111 |
--let ALL_ZEROES=0 |
| 112 |
--source ../include/corrupt_page.inc |
| 113 |
|
| 114 |
--source include/start_mysqld.inc |
| 115 |
|
| 116 |
CHECK TABLE t1; |
| 117 |
SELECT f1, f2 FROM t1; |
| 118 |
|
| 119 |
--echo # Test End |
| 120 |
--echo # --------------------------------------------------------------- |
| 121 |
--echo # Test Begin: Test if recovery works if 2nd page of user |
| 122 |
--echo # tablespace is full of zeroes. |
| 123 |
|
| 124 |
SELECT space FROM INFORMATION_SCHEMA.INNODB_TABLESPACES |
| 125 |
WHERE name = 'test/t1' INTO @space_id; |
| 126 |
|
| 127 |
--echo # Ensure that dirty pages of table t1 is flushed. |
| 128 |
FLUSH TABLES t1 FOR EXPORT; |
| 129 |
UNLOCK TABLES; |
| 130 |
|
| 131 |
SET GLOBAL innodb_checkpoint_disabled=1; |
| 132 |
|
| 133 |
BEGIN; |
| 134 |
INSERT INTO t1 VALUES (6, repeat('%', 400)); |
| 135 |
|
| 136 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 137 |
|
| 138 |
--echo # Make the 2nd page dirty for table t1 |
| 139 |
SET GLOBAL innodb_saved_page_number_debug = 1; |
| 140 |
|
| 141 |
# Set the page dirty and force a flush to disk |
| 142 |
--source include/expect_crash.inc |
| 143 |
--error CR_SERVER_LOST |
| 144 |
SET GLOBAL innodb_fil_make_page_dirty_debug = @space_id; |
| 145 |
|
| 146 |
--echo # Make the 2nd page (page_no=1) of the tablespace all zeroes. |
| 147 |
--let IBD_FILE=$MYSQLD_DATADIR/test/t1.ibd |
| 148 |
--let PAGE_NUM=1 |
| 149 |
--let ALL_ZEROES=1 |
| 150 |
--source ../include/corrupt_page.inc |
| 151 |
|
| 152 |
--source include/start_mysqld.inc |
| 153 |
|
| 154 |
CHECK TABLE t1; |
| 155 |
SELECT f1, f2 FROM t1; |
| 156 |
|
| 157 |
--echo # Test End |
| 158 |
--echo # --------------------------------------------------------------- |
| 159 |
--echo # Test Begin: Test if recovery works if 2nd page of user |
| 160 |
--echo # tablespace is corrupted. |
| 161 |
|
| 162 |
SELECT space FROM INFORMATION_SCHEMA.INNODB_TABLESPACES |
| 163 |
WHERE name = 'test/t1' into @space_id; |
| 164 |
|
| 165 |
--echo # Ensure that dirty pages of table t1 is flushed. |
| 166 |
FLUSH TABLES t1 FOR EXPORT; |
| 167 |
UNLOCK TABLES; |
| 168 |
|
| 169 |
SET GLOBAL innodb_checkpoint_disabled=1; |
| 170 |
|
| 171 |
BEGIN; |
| 172 |
INSERT INTO t1 VALUES (6, repeat('%', 400)); |
| 173 |
|
| 174 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 175 |
|
| 176 |
--echo # Make the 2nd page dirty for table t1 |
| 177 |
SET GLOBAL innodb_saved_page_number_debug = 1; |
| 178 |
|
| 179 |
# Set the page dirty and force a flush to disk |
| 180 |
--source include/expect_crash.inc |
| 181 |
--error CR_SERVER_LOST |
| 182 |
SET GLOBAL innodb_fil_make_page_dirty_debug = @space_id; |
| 183 |
|
| 184 |
--echo # Corrupt the 2nd page (page_no=1) of the user tablespace. |
| 185 |
--let IBD_FILE=$MYSQLD_DATADIR/test/t1.ibd |
| 186 |
--let PAGE_NUM=1 |
| 187 |
--let ALL_ZEROES=0 |
| 188 |
--source ../include/corrupt_page.inc |
| 189 |
|
| 190 |
--source include/start_mysqld.inc |
| 191 |
|
| 192 |
CHECK TABLE t1; |
| 193 |
SELECT f1, f2 FROM t1; |
| 194 |
|
| 195 |
--echo # Test End |
| 196 |
--echo # --------------------------------------------------------------- |
| 197 |
--echo # Test Begin: Test if recovery works if first page of |
| 198 |
--echo # system tablespace is full of zeroes. |
| 199 |
|
| 200 |
SET GLOBAL innodb_master_thread_disabled_debug=1; |
| 201 |
|
| 202 |
BEGIN; |
| 203 |
INSERT INTO t1 VALUES (6, repeat('%', 400)); |
| 204 |
|
| 205 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 206 |
|
| 207 |
--echo # Make the first page dirty for system tablespace |
| 208 |
SET GLOBAL innodb_saved_page_number_debug = 0; |
| 209 |
|
| 210 |
# Set the page dirty and force a flush to disk |
| 211 |
--source include/expect_crash.inc |
| 212 |
--error CR_SERVER_LOST |
| 213 |
SET GLOBAL innodb_fil_make_page_dirty_debug = 0; |
| 214 |
|
| 215 |
--echo # Make the first page (page_no=0) of the system tablespace |
| 216 |
--echo # all zeroes. |
| 217 |
--let IBD_FILE=$MYSQLD_DATADIR/ibdata1 |
| 218 |
--let PAGE_NUM="0" |
| 219 |
--let ALL_ZEROES=1 |
| 220 |
--source ../include/corrupt_page.inc |
| 221 |
|
| 222 |
--source include/start_mysqld.inc |
| 223 |
|
| 224 |
CHECK TABLE t1; |
| 225 |
SELECT f1, f2 FROM t1; |
| 226 |
|
| 227 |
--echo # Test End |
| 228 |
--echo # --------------------------------------------------------------- |
| 229 |
--echo # Test Begin: Test if recovery works if first page of |
| 230 |
--echo # system tablespace is corrupted. |
| 231 |
|
| 232 |
SET GLOBAL innodb_master_thread_disabled_debug=1; |
| 233 |
|
| 234 |
BEGIN; |
| 235 |
INSERT INTO t1 VALUES (6, repeat('%', 400)); |
| 236 |
|
| 237 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 238 |
|
| 239 |
--echo # Make the first page dirty for system tablespace |
| 240 |
SET GLOBAL innodb_saved_page_number_debug = 0; |
| 241 |
|
| 242 |
# Set the page dirty and force a flush to disk |
| 243 |
--source include/expect_crash.inc |
| 244 |
--error CR_SERVER_LOST |
| 245 |
SET GLOBAL innodb_fil_make_page_dirty_debug = 0; |
| 246 |
|
| 247 |
--echo # Corrupt the first page (page_no=0) of the system tablespace. |
| 248 |
--let IBD_FILE=$MYSQLD_DATADIR/ibdata1 |
| 249 |
--let PAGE_NUM="0" |
| 250 |
--let ALL_ZEROES=0 |
| 251 |
--source ../include/corrupt_page.inc |
| 252 |
|
| 253 |
--source include/start_mysqld.inc |
| 254 |
|
| 255 |
CHECK TABLE t1; |
| 256 |
SELECT f1, f2 FROM t1; |
| 257 |
|
| 258 |
--echo # Test End |
| 259 |
--echo # --------------------------------------------------------------- |
| 260 |
--echo # Test Begin: Test if recovery works if 2nd page of |
| 261 |
--echo # system tablespace is full of zeroes. |
| 262 |
|
| 263 |
SET GLOBAL innodb_master_thread_disabled_debug=1; |
| 264 |
|
| 265 |
BEGIN; |
| 266 |
INSERT INTO t1 VALUES (6, repeat('%', 400)); |
| 267 |
|
| 268 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 269 |
|
| 270 |
--echo # Make the second page dirty for system tablespace |
| 271 |
SET GLOBAL innodb_saved_page_number_debug = 1; |
| 272 |
|
| 273 |
# Set the page dirty and force a flush to disk |
| 274 |
--source include/expect_crash.inc |
| 275 |
--error CR_SERVER_LOST |
| 276 |
SET GLOBAL innodb_fil_make_page_dirty_debug = 0; |
| 277 |
|
| 278 |
--echo # Make the 2nd page (page_no=1) of the system tablespace |
| 279 |
--echo # all zeroes. |
| 280 |
--let IBD_FILE=$MYSQLD_DATADIR/ibdata1 |
| 281 |
--let PAGE_NUM=1 |
| 282 |
--let ALL_ZEROES=1 |
| 283 |
--source ../include/corrupt_page.inc |
| 284 |
|
| 285 |
--source include/start_mysqld.inc |
| 286 |
|
| 287 |
CHECK TABLE t1; |
| 288 |
SELECT f1, f2 FROM t1; |
| 289 |
|
| 290 |
--echo # Test End |
| 291 |
--echo # --------------------------------------------------------------- |
| 292 |
--echo # Test Begin: Test if recovery works if 2nd page of |
| 293 |
--echo # system tablespace is corrupted. |
| 294 |
|
| 295 |
SET GLOBAL innodb_master_thread_disabled_debug=1; |
| 296 |
|
| 297 |
BEGIN; |
| 298 |
INSERT INTO t1 VALUES (6, repeat('%', 400)); |
| 299 |
|
| 300 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 301 |
|
| 302 |
--echo # Make the second page dirty for system tablespace |
| 303 |
SET GLOBAL innodb_saved_page_number_debug = 1; |
| 304 |
|
| 305 |
# Set the page dirty and force a flush to disk |
| 306 |
--source include/expect_crash.inc |
| 307 |
--error CR_SERVER_LOST |
| 308 |
SET GLOBAL innodb_fil_make_page_dirty_debug = 0; |
| 309 |
|
| 310 |
--echo # Make the 2nd page (page_no=1) of the system tablespace |
| 311 |
--echo # all zeroes. |
| 312 |
--let IBD_FILE=$MYSQLD_DATADIR/ibdata1 |
| 313 |
--let PAGE_NUM=1 |
| 314 |
--let ALL_ZEROES=0 |
| 315 |
--source ../include/corrupt_page.inc |
| 316 |
|
| 317 |
--source include/start_mysqld.inc |
| 318 |
|
| 319 |
CHECK TABLE t1; |
| 320 |
SELECT f1, f2 FROM t1; |
| 321 |
|
| 322 |
--echo # Test End |
| 323 |
--echo # --------------------------------------------------------------- |
| 324 |
|
| 325 |
DROP TABLE t1; |
| 326 |
|