|
| 1 | +# |
| 2 | +# Bug #17335427 INNODB CAN NOT USE THE DOUBLEWRITE BUFFER PROPERLY |
| 3 | +# Bug #18144349 INNODB CANNOT USE THE DOUBLEWRITE BUFFER FOR THE FIRST |
| 4 | +# PAGE OF SYSTEM TABLESPACE |
| 5 | +# |
| 6 | +SET GLOBAL innodb_fast_shutdown = 0; |
| 7 | +show variables like 'innodb_doublewrite'; |
| 8 | +Variable_name Value |
| 9 | +innodb_doublewrite ON |
| 10 | +show variables like 'innodb_fil_make_page_dirty_debug'; |
| 11 | +Variable_name Value |
| 12 | +innodb_fil_make_page_dirty_debug 0 |
| 13 | +show variables like 'innodb_saved_page_number_debug'; |
| 14 | +Variable_name Value |
| 15 | +innodb_saved_page_number_debug 0 |
| 16 | +create table t1 (f1 int primary key, f2 blob) engine=innodb; |
| 17 | +start transaction; |
| 18 | +insert into t1 values(1, repeat('#',12)); |
| 19 | +insert into t1 values(2, repeat('+',12)); |
| 20 | +insert into t1 values(3, repeat('/',12)); |
| 21 | +insert into t1 values(4, repeat('-',12)); |
| 22 | +insert into t1 values(5, repeat('.',12)); |
| 23 | +commit work; |
| 24 | +# --------------------------------------------------------------- |
| 25 | +# Test Begin: Test if recovery works if first page of user |
| 26 | +# tablespace is full of zeroes. |
| 27 | +select space from information_schema.innodb_sys_tables |
| 28 | +where name = 'test/t1' into @space_id; |
| 29 | +# Ensure that dirty pages of table t1 is flushed. |
| 30 | +flush tables t1 for export; |
| 31 | +unlock tables; |
| 32 | +begin; |
| 33 | +insert into t1 values (6, repeat('%', 12)); |
| 34 | +# Make the first page dirty for table t1 |
| 35 | +set global innodb_saved_page_number_debug = 0; |
| 36 | +set global innodb_fil_make_page_dirty_debug = @space_id; |
| 37 | +# Ensure that dirty pages of table t1 are flushed. |
| 38 | +set global innodb_buf_flush_list_now = 1; |
| 39 | +# Kill the server |
| 40 | +# Make the first page (page_no=0) of the user tablespace |
| 41 | +# full of zeroes. |
| 42 | +check table t1; |
| 43 | +Table Op Msg_type Msg_text |
| 44 | +test.t1 check status OK |
| 45 | +select f1, f2 from t1; |
| 46 | +f1 f2 |
| 47 | +1 ############ |
| 48 | +2 ++++++++++++ |
| 49 | +3 //////////// |
| 50 | +4 ------------ |
| 51 | +5 ............ |
| 52 | +# Test End |
| 53 | +# --------------------------------------------------------------- |
| 54 | +# Test Begin: Test if recovery works if first page of user |
| 55 | +# tablespace is corrupted. |
| 56 | +select space from information_schema.innodb_sys_tables |
| 57 | +where name = 'test/t1' into @space_id; |
| 58 | +# Ensure that dirty pages of table t1 is flushed. |
| 59 | +flush tables t1 for export; |
| 60 | +unlock tables; |
| 61 | +begin; |
| 62 | +insert into t1 values (6, repeat('%', 12)); |
| 63 | +# Make the first page dirty for table t1 |
| 64 | +set global innodb_saved_page_number_debug = 0; |
| 65 | +set global innodb_fil_make_page_dirty_debug = @space_id; |
| 66 | +# Ensure that dirty pages of table t1 are flushed. |
| 67 | +set global innodb_buf_flush_list_now = 1; |
| 68 | +# Kill the server |
| 69 | +# Corrupt the first page (page_no=0) of the user tablespace. |
| 70 | +check table t1; |
| 71 | +Table Op Msg_type Msg_text |
| 72 | +test.t1 check status OK |
| 73 | +select f1, f2 from t1; |
| 74 | +f1 f2 |
| 75 | +1 ############ |
| 76 | +2 ++++++++++++ |
| 77 | +3 //////////// |
| 78 | +4 ------------ |
| 79 | +5 ............ |
| 80 | +# Test End |
| 81 | +# --------------------------------------------------------------- |
| 82 | +# Test Begin: Test if recovery works if 2nd page of user |
| 83 | +# tablespace is full of zeroes. |
| 84 | +select space from information_schema.innodb_sys_tables |
| 85 | +where name = 'test/t1' into @space_id; |
| 86 | +# Ensure that dirty pages of table t1 is flushed. |
| 87 | +flush tables t1 for export; |
| 88 | +unlock tables; |
| 89 | +begin; |
| 90 | +insert into t1 values (6, repeat('%', 400)); |
| 91 | +# Make the 2nd page dirty for table t1 |
| 92 | +set global innodb_saved_page_number_debug = 1; |
| 93 | +set global innodb_fil_make_page_dirty_debug = @space_id; |
| 94 | +# Ensure that dirty pages of table t1 are flushed. |
| 95 | +set global innodb_buf_flush_list_now = 1; |
| 96 | +# Kill the server |
| 97 | +# Make the 2nd page (page_no=1) of the tablespace all zeroes. |
| 98 | +check table t1; |
| 99 | +Table Op Msg_type Msg_text |
| 100 | +test.t1 check status OK |
| 101 | +select f1, f2 from t1; |
| 102 | +f1 f2 |
| 103 | +1 ############ |
| 104 | +2 ++++++++++++ |
| 105 | +3 //////////// |
| 106 | +4 ------------ |
| 107 | +5 ............ |
| 108 | +# Test End |
| 109 | +# --------------------------------------------------------------- |
| 110 | +# Test Begin: Test if recovery works if 2nd page of user |
| 111 | +# tablespace is corrupted. |
| 112 | +select space from information_schema.innodb_sys_tables |
| 113 | +where name = 'test/t1' into @space_id; |
| 114 | +# Ensure that dirty pages of table t1 is flushed. |
| 115 | +flush tables t1 for export; |
| 116 | +unlock tables; |
| 117 | +begin; |
| 118 | +insert into t1 values (6, repeat('%', 400)); |
| 119 | +# Make the 2nd page dirty for table t1 |
| 120 | +set global innodb_saved_page_number_debug = 1; |
| 121 | +set global innodb_fil_make_page_dirty_debug = @space_id; |
| 122 | +# Ensure that the dirty pages of table t1 are flushed. |
| 123 | +set global innodb_buf_flush_list_now = 1; |
| 124 | +# Kill the server |
| 125 | +# Corrupt the 2nd page (page_no=1) of the user tablespace. |
| 126 | +check table t1; |
| 127 | +Table Op Msg_type Msg_text |
| 128 | +test.t1 check status OK |
| 129 | +select f1, f2 from t1; |
| 130 | +f1 f2 |
| 131 | +1 ############ |
| 132 | +2 ++++++++++++ |
| 133 | +3 //////////// |
| 134 | +4 ------------ |
| 135 | +5 ............ |
| 136 | +# Test End |
| 137 | +# --------------------------------------------------------------- |
| 138 | +# Test Begin: Test if recovery works if first page of |
| 139 | +# system tablespace is full of zeroes. |
| 140 | +begin; |
| 141 | +insert into t1 values (6, repeat('%', 400)); |
| 142 | +# Ensure that all dirty pages in the system are flushed. |
| 143 | +set global innodb_buf_flush_list_now = 1; |
| 144 | +# Make the first page dirty for system tablespace |
| 145 | +set global innodb_saved_page_number_debug = 0; |
| 146 | +set global innodb_fil_make_page_dirty_debug = 0; |
| 147 | +# Ensure that the dirty page of system tablespace is also flushed. |
| 148 | +set global innodb_buf_flush_list_now = 1; |
| 149 | +# Kill the server |
| 150 | +# Make the first page (page_no=0) of the system tablespace |
| 151 | +# all zeroes. |
| 152 | +check table t1; |
| 153 | +Table Op Msg_type Msg_text |
| 154 | +test.t1 check status OK |
| 155 | +select f1, f2 from t1; |
| 156 | +f1 f2 |
| 157 | +1 ############ |
| 158 | +2 ++++++++++++ |
| 159 | +3 //////////// |
| 160 | +4 ------------ |
| 161 | +5 ............ |
| 162 | +# Test End |
| 163 | +# --------------------------------------------------------------- |
| 164 | +# Test Begin: Test if recovery works if first page of |
| 165 | +# system tablespace is corrupted. |
| 166 | +begin; |
| 167 | +insert into t1 values (6, repeat('%', 400)); |
| 168 | +# Ensure that all dirty pages in the system are flushed. |
| 169 | +set global innodb_buf_flush_list_now = 1; |
| 170 | +# Make the first page dirty for system tablespace |
| 171 | +set global innodb_saved_page_number_debug = 0; |
| 172 | +set global innodb_fil_make_page_dirty_debug = 0; |
| 173 | +# Ensure that the dirty page of system tablespace is also flushed. |
| 174 | +set global innodb_buf_flush_list_now = 1; |
| 175 | +# Kill the server |
| 176 | +# Corrupt the first page (page_no=0) of the system tablespace. |
| 177 | +check table t1; |
| 178 | +Table Op Msg_type Msg_text |
| 179 | +test.t1 check status OK |
| 180 | +select f1, f2 from t1; |
| 181 | +f1 f2 |
| 182 | +1 ############ |
| 183 | +2 ++++++++++++ |
| 184 | +3 //////////// |
| 185 | +4 ------------ |
| 186 | +5 ............ |
| 187 | +# Test End |
| 188 | +# --------------------------------------------------------------- |
| 189 | +# Test Begin: Test if recovery works if 2nd page of |
| 190 | +# system tablespace is full of zeroes. |
| 191 | +begin; |
| 192 | +insert into t1 values (6, repeat('%', 400)); |
| 193 | +# Ensure that all dirty pages in the system are flushed. |
| 194 | +set global innodb_buf_flush_list_now = 1; |
| 195 | +# Make the second page dirty for system tablespace |
| 196 | +set global innodb_saved_page_number_debug = 1; |
| 197 | +set global innodb_fil_make_page_dirty_debug = 0; |
| 198 | +# Ensure that the dirty page of system tablespace is also flushed. |
| 199 | +set global innodb_buf_flush_list_now = 1; |
| 200 | +# Kill the server |
| 201 | +# Make the 2nd page (page_no=1) of the system tablespace |
| 202 | +# all zeroes. |
| 203 | +check table t1; |
| 204 | +Table Op Msg_type Msg_text |
| 205 | +test.t1 check status OK |
| 206 | +select f1, f2 from t1; |
| 207 | +f1 f2 |
| 208 | +1 ############ |
| 209 | +2 ++++++++++++ |
| 210 | +3 //////////// |
| 211 | +4 ------------ |
| 212 | +5 ............ |
| 213 | +# Test End |
| 214 | +# --------------------------------------------------------------- |
| 215 | +# Test Begin: Test if recovery works if 2nd page of |
| 216 | +# system tablespace is corrupted. |
| 217 | +begin; |
| 218 | +insert into t1 values (6, repeat('%', 400)); |
| 219 | +# Ensure that all dirty pages in the system are flushed. |
| 220 | +set global innodb_buf_flush_list_now = 1; |
| 221 | +# Make the second page dirty for system tablespace |
| 222 | +set global innodb_saved_page_number_debug = 1; |
| 223 | +set global innodb_fil_make_page_dirty_debug = 0; |
| 224 | +# Ensure that the dirty page of system tablespace is also flushed. |
| 225 | +set global innodb_buf_flush_list_now = 1; |
| 226 | +# Kill the server |
| 227 | +# Make the 2nd page (page_no=1) of the system tablespace |
| 228 | +# all zeroes. |
| 229 | +check table t1; |
| 230 | +Table Op Msg_type Msg_text |
| 231 | +test.t1 check status OK |
| 232 | +select f1, f2 from t1; |
| 233 | +f1 f2 |
| 234 | +1 ############ |
| 235 | +2 ++++++++++++ |
| 236 | +3 //////////// |
| 237 | +4 ------------ |
| 238 | +5 ............ |
| 239 | +# Test End |
| 240 | +# --------------------------------------------------------------- |
| 241 | +drop table t1; |
0 commit comments