| 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/innodb_page_size.inc |
| 8 |
--source include/have_debug.inc |
| 9 |
--source include/not_embedded.inc |
| 10 |
--disable_query_log |
| 11 |
call mtr.add_suppression("InnoDB: Data file .* uses page size .* but the innodb_page_size start-up parameter is"); |
| 12 |
call mtr.add_suppression("InnoDB: adjusting FSP_SPACE_FLAGS"); |
| 13 |
call mtr.add_suppression("InnoDB: New log files created"); |
| 14 |
call mtr.add_suppression("InnoDB: Cannot create doublewrite buffer: the first file in innodb_data_file_path must be at least (3|6|12)M\\."); |
| 15 |
call mtr.add_suppression("InnoDB: Database creation was aborted"); |
| 16 |
call mtr.add_suppression("Plugin 'InnoDB' (init function returned error|registration as a STORAGE ENGINE failed)"); |
| 17 |
call mtr.add_suppression("InnoDB: A bad Space ID was found in datafile"); |
| 18 |
call mtr.add_suppression("InnoDB: Checksum mismatch in datafile: "); |
| 19 |
call mtr.add_suppression("InnoDB: Inconsistent tablespace ID in .*t1\\.ibd"); |
| 20 |
call mtr.add_suppression("InnoDB: Header page consists of zero bytes in datafile:"); |
| 21 |
--enable_query_log |
| 22 |
|
| 23 |
let INNODB_PAGE_SIZE=`select @@innodb_page_size`; |
| 24 |
let MYSQLD_DATADIR=`select @@datadir`; |
| 25 |
let ALGO=`select @@innodb_checksum_algorithm`; |
| 26 |
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; |
| 27 |
|
| 28 |
show variables like 'innodb_doublewrite'; |
| 29 |
show variables like 'innodb_fil_make_page_dirty_debug'; |
| 30 |
show variables like 'innodb_saved_page_number_debug'; |
| 31 |
|
| 32 |
create table t1 (f1 int primary key, f2 blob) engine=innodb stats_persistent=0; |
| 33 |
|
| 34 |
start transaction; |
| 35 |
insert into t1 values(1, repeat('#',12)); |
| 36 |
insert into t1 values(2, repeat('+',12)); |
| 37 |
insert into t1 values(3, repeat('/',12)); |
| 38 |
insert into t1 values(4, repeat('-',12)); |
| 39 |
insert into t1 values(5, repeat('.',12)); |
| 40 |
commit work; |
| 41 |
|
| 42 |
--echo # Test Begin: Test if recovery works if 1st page and 2nd page |
| 43 |
--echo # of system tablespace is full of zeroes. |
| 44 |
|
| 45 |
# Slow shutdown and restart to make sure ibuf merge is finished |
| 46 |
SET GLOBAL innodb_fast_shutdown = 0; |
| 47 |
let $shutdown_timeout=; |
| 48 |
let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0; |
| 49 |
--source include/restart_mysqld.inc |
| 50 |
--source ../include/no_checkpoint_start.inc |
| 51 |
begin; |
| 52 |
insert into t1 values (6, repeat('%', 400)); |
| 53 |
|
| 54 |
SET GLOBAL innodb_max_dirty_pages_pct_lwm=0, innodb_max_dirty_pages_pct=0; |
| 55 |
|
| 56 |
--echo # Make the first page dirty for system tablespace |
| 57 |
set global innodb_saved_page_number_debug = 0; |
| 58 |
set global innodb_fil_make_page_dirty_debug = 0; |
| 59 |
|
| 60 |
--echo # Make the second page dirty for system tablespace |
| 61 |
set global innodb_saved_page_number_debug = 1; |
| 62 |
set global innodb_fil_make_page_dirty_debug = 0; |
| 63 |
|
| 64 |
let $wait_condition = |
| 65 |
SELECT variable_value = 0 |
| 66 |
FROM information_schema.global_status |
| 67 |
WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'; |
| 68 |
--source include/wait_condition.inc |
| 69 |
|
| 70 |
--let CLEANUP_IF_CHECKPOINT=drop table t1, unexpected_checkpoint; |
| 71 |
--source ../include/no_checkpoint_end.inc |
| 72 |
|
| 73 |
--echo # Make the 1st page (page_no=0) and 2nd page (page_no=1) |
| 74 |
--echo # of the system tablespace all zeroes. |
| 75 |
perl; |
| 76 |
use IO::Handle; |
| 77 |
my $fname= "$ENV{'MYSQLD_DATADIR'}ibdata1"; |
| 78 |
open(FILE, "+<", $fname) or die; |
| 79 |
FILE->autoflush(1); |
| 80 |
binmode FILE; |
| 81 |
print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}); |
| 82 |
seek(FILE, $ENV{'INNODB_PAGE_SIZE'}, SEEK_SET); |
| 83 |
print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}); |
| 84 |
close FILE; |
| 85 |
EOF |
| 86 |
|
| 87 |
let $restart_parameters=; |
| 88 |
--source include/start_mysqld.inc |
| 89 |
|
| 90 |
let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=0, page number=0\\]; |
| 91 |
--source include/search_pattern_in_file.inc |
| 92 |
|
| 93 |
let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=0, page number=1\\]; |
| 94 |
--source include/search_pattern_in_file.inc |
| 95 |
|
| 96 |
check table t1; |
| 97 |
select f1, f2 from t1; |
| 98 |
|
| 99 |
--echo # Test End |
| 100 |
--echo # --------------------------------------------------------------- |
| 101 |
--echo # Test Begin: Test if recovery works if 1st page of |
| 102 |
--echo # system tablespace is corrupted and 2nd page as corrupted. |
| 103 |
|
| 104 |
let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0; |
| 105 |
--source include/restart_mysqld.inc |
| 106 |
--source ../include/no_checkpoint_start.inc |
| 107 |
begin; |
| 108 |
insert into t1 values (6, repeat('%', 400)); |
| 109 |
|
| 110 |
--echo # Make the first page dirty for system tablespace |
| 111 |
set global innodb_saved_page_number_debug = 0; |
| 112 |
set global innodb_fil_make_page_dirty_debug = 0; |
| 113 |
|
| 114 |
--echo # Make the second page dirty for system tablespace |
| 115 |
set global innodb_saved_page_number_debug = 1; |
| 116 |
set global innodb_fil_make_page_dirty_debug = 0; |
| 117 |
|
| 118 |
set global innodb_buf_flush_list_now = 1; |
| 119 |
|
| 120 |
--source ../include/no_checkpoint_end.inc |
| 121 |
|
| 122 |
--echo # Corrupt the 1st page (page_no=0) and 2nd page of the system tablespace. |
| 123 |
perl; |
| 124 |
use IO::Handle; |
| 125 |
my $fname= "$ENV{'MYSQLD_DATADIR'}ibdata1"; |
| 126 |
open(FILE, "+<", $fname) or die; |
| 127 |
FILE->autoflush(1); |
| 128 |
binmode FILE; |
| 129 |
print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}/2); |
| 130 |
seek(FILE, $ENV{'INNODB_PAGE_SIZE'}, SEEK_SET); |
| 131 |
print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}/2); |
| 132 |
close FILE; |
| 133 |
EOF |
| 134 |
|
| 135 |
let $restart_parameters=; |
| 136 |
--source include/start_mysqld.inc |
| 137 |
|
| 138 |
let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=0, page number=0\\]; |
| 139 |
--source include/search_pattern_in_file.inc |
| 140 |
|
| 141 |
let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=0, page number=1\\]; |
| 142 |
--source include/search_pattern_in_file.inc |
| 143 |
|
| 144 |
check table t1; |
| 145 |
select f1, f2 from t1; |
| 146 |
drop table t1; |
| 147 |
let $shutdown_timeout=; |
| 148 |
--echo # Test End |
| 149 |
--echo # --------------------------------------------------------------- |
| 150 |
--echo # |
| 151 |
--echo # MDEV-12600 crash during install_db with innodb_page_size=32K |
| 152 |
--echo # and ibdata1=3M |
| 153 |
--echo # |
| 154 |
let bugdir= $MYSQLTEST_VARDIR/tmp/doublewrite; |
| 155 |
--mkdir $bugdir |
| 156 |
|
| 157 |
let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES |
| 158 |
WHERE engine = 'innodb' |
| 159 |
AND support IN ('YES', 'DEFAULT', 'ENABLED'); |
| 160 |
|
| 161 |
--let $ibp=--innodb-log-group-home-dir=$bugdir --innodb-data-home-dir=$bugdir |
| 162 |
--let $ibp=$ibp --innodb-undo-tablespaces=0 |
| 163 |
--let $ibp=$ibp --innodb-data-file-path=ibdata1:1M;ibdata2:1M:autoextend |
| 164 |
|
| 165 |
--let $restart_parameters= $ibp |
| 166 |
--source include/restart_mysqld.inc |
| 167 |
eval $check_no_innodb; |
| 168 |
--let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot create doublewrite buffer |
| 169 |
--source include/search_pattern_in_file.inc |
| 170 |
--let $restart_parameters= |
| 171 |
--source include/restart_mysqld.inc |
| 172 |
|
| 173 |
--remove_file $bugdir/ibdata1 |
| 174 |
--remove_file $bugdir/ibdata2 |
| 175 |
--remove_file $bugdir/ib_logfile0 |
| 176 |
--rmdir $bugdir |