| 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 |
# restart |
| 8 |
SHOW VARIABLES LIKE 'innodb_doublewrite'; |
| 9 |
Variable_name Value |
| 10 |
innodb_doublewrite ON |
| 11 |
SHOW VARIABLES LIKE 'innodb_fil_make_page_dirty_debug'; |
| 12 |
Variable_name Value |
| 13 |
innodb_fil_make_page_dirty_debug 4294967295 |
| 14 |
SHOW VARIABLES LIKE 'innodb_saved_page_number_debug'; |
| 15 |
Variable_name Value |
| 16 |
innodb_saved_page_number_debug 0 |
| 17 |
create table t1 (f1 int primary key, f2 blob) engine=innodb; |
| 18 |
START TRANSACTION; |
| 19 |
INSERT INTO t1 VALUES(1, repeat('#',12)); |
| 20 |
INSERT INTO t1 VALUES(2, repeat('+',12)); |
| 21 |
INSERT INTO t1 VALUES(3, repeat('/',12)); |
| 22 |
INSERT INTO t1 VALUES(4, repeat('-',12)); |
| 23 |
INSERT INTO t1 VALUES(5, repeat('.',12)); |
| 24 |
COMMIT WORK; |
| 25 |
# --------------------------------------------------------------- |
| 26 |
# Test Begin: Test if recovery works if first page of user |
| 27 |
# tablespace is full of zeroes. |
| 28 |
# Wait for purge to complete |
| 29 |
# Ensure that dirty pages of table t1 is flushed. |
| 30 |
FLUSH TABLES t1 FOR EXPORT; |
| 31 |
UNLOCK TABLES; |
| 32 |
SELECT space FROM INFORMATION_SCHEMA.INNODB_TABLESPACEs |
| 33 |
WHERE name = 'test/t1' INTO @space_id; |
| 34 |
SET GLOBAL innodb_checkpoint_disabled=1; |
| 35 |
BEGIN; |
| 36 |
INSERT INTO t1 VALUES (6, repeat('%', 12)); |
| 37 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 38 |
# Make the first page dirty for table t1 |
| 39 |
SET GLOBAL innodb_saved_page_number_debug = 0; |
| 40 |
SET GLOBAL innodb_fil_make_page_dirty_debug = @space_id; |
| 41 |
ERROR HY000: Lost connection to MySQL server during query |
| 42 |
# Make the first page (page_no=0) of the user tablespace |
| 43 |
# full of zeroes. |
| 44 |
# restart |
| 45 |
CHECK TABLE t1; |
| 46 |
Table Op Msg_type Msg_text |
| 47 |
test.t1 check status OK |
| 48 |
SELECT f1, f2 FROM t1; |
| 49 |
f1 f2 |
| 50 |
1 ############ |
| 51 |
2 ++++++++++++ |
| 52 |
3 //////////// |
| 53 |
4 ------------ |
| 54 |
5 ............ |
| 55 |
# Test End |
| 56 |
# --------------------------------------------------------------- |
| 57 |
# Test Begin: Test if recovery works if first page of user |
| 58 |
# tablespace is corrupted. |
| 59 |
SELECT space from INFORMATION_SCHEMA.INNODB_TABLESPACES |
| 60 |
WHERE name = 'test/t1' INTO @space_id; |
| 61 |
# Ensure that dirty pages of table t1 is flushed. |
| 62 |
FLUSH TABLES t1 FOR EXPORT; |
| 63 |
UNLOCK TABLES; |
| 64 |
SET GLOBAL innodb_checkpoint_disabled=1; |
| 65 |
BEGIN; |
| 66 |
INSERT INTO t1 VALUES (6, repeat('%', 12)); |
| 67 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 68 |
# Make the first page dirty for table t1 |
| 69 |
SET GLOBAL innodb_saved_page_number_debug = 0; |
| 70 |
SET GLOBAL innodb_fil_make_page_dirty_debug = @space_id; |
| 71 |
ERROR HY000: Lost connection to MySQL server during query |
| 72 |
# Corrupt the first page (page_no=0) of the user tablespace. |
| 73 |
# restart |
| 74 |
CHECK TABLE t1; |
| 75 |
Table Op Msg_type Msg_text |
| 76 |
test.t1 check status OK |
| 77 |
SELECT f1, f2 FROM t1; |
| 78 |
f1 f2 |
| 79 |
1 ############ |
| 80 |
2 ++++++++++++ |
| 81 |
3 //////////// |
| 82 |
4 ------------ |
| 83 |
5 ............ |
| 84 |
# Test End |
| 85 |
# --------------------------------------------------------------- |
| 86 |
# Test Begin: Test if recovery works if 2nd page of user |
| 87 |
# tablespace is full of zeroes. |
| 88 |
SELECT space FROM INFORMATION_SCHEMA.INNODB_TABLESPACES |
| 89 |
WHERE name = 'test/t1' INTO @space_id; |
| 90 |
# Ensure that dirty pages of table t1 is flushed. |
| 91 |
FLUSH TABLES t1 FOR EXPORT; |
| 92 |
UNLOCK TABLES; |
| 93 |
SET GLOBAL innodb_checkpoint_disabled=1; |
| 94 |
BEGIN; |
| 95 |
INSERT INTO t1 VALUES (6, repeat('%', 400)); |
| 96 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 97 |
# Make the 2nd page dirty for table t1 |
| 98 |
SET GLOBAL innodb_saved_page_number_debug = 1; |
| 99 |
SET GLOBAL innodb_fil_make_page_dirty_debug = @space_id; |
| 100 |
ERROR HY000: Lost connection to MySQL server during query |
| 101 |
# Make the 2nd page (page_no=1) of the tablespace all zeroes. |
| 102 |
# restart |
| 103 |
CHECK TABLE t1; |
| 104 |
Table Op Msg_type Msg_text |
| 105 |
test.t1 check status OK |
| 106 |
SELECT f1, f2 FROM t1; |
| 107 |
f1 f2 |
| 108 |
1 ############ |
| 109 |
2 ++++++++++++ |
| 110 |
3 //////////// |
| 111 |
4 ------------ |
| 112 |
5 ............ |
| 113 |
# Test End |
| 114 |
# --------------------------------------------------------------- |
| 115 |
# Test Begin: Test if recovery works if 2nd page of user |
| 116 |
# tablespace is corrupted. |
| 117 |
SELECT space FROM INFORMATION_SCHEMA.INNODB_TABLESPACES |
| 118 |
WHERE name = 'test/t1' into @space_id; |
| 119 |
# Ensure that dirty pages of table t1 is flushed. |
| 120 |
FLUSH TABLES t1 FOR EXPORT; |
| 121 |
UNLOCK TABLES; |
| 122 |
SET GLOBAL innodb_checkpoint_disabled=1; |
| 123 |
BEGIN; |
| 124 |
INSERT INTO t1 VALUES (6, repeat('%', 400)); |
| 125 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 126 |
# Make the 2nd page dirty for table t1 |
| 127 |
SET GLOBAL innodb_saved_page_number_debug = 1; |
| 128 |
SET GLOBAL innodb_fil_make_page_dirty_debug = @space_id; |
| 129 |
ERROR HY000: Lost connection to MySQL server during query |
| 130 |
# Corrupt the 2nd page (page_no=1) of the user tablespace. |
| 131 |
# restart |
| 132 |
CHECK TABLE t1; |
| 133 |
Table Op Msg_type Msg_text |
| 134 |
test.t1 check status OK |
| 135 |
SELECT f1, f2 FROM t1; |
| 136 |
f1 f2 |
| 137 |
1 ############ |
| 138 |
2 ++++++++++++ |
| 139 |
3 //////////// |
| 140 |
4 ------------ |
| 141 |
5 ............ |
| 142 |
# Test End |
| 143 |
# --------------------------------------------------------------- |
| 144 |
# Test Begin: Test if recovery works if first page of |
| 145 |
# system tablespace is full of zeroes. |
| 146 |
SET GLOBAL innodb_master_thread_disabled_debug=1; |
| 147 |
BEGIN; |
| 148 |
INSERT INTO t1 VALUES (6, repeat('%', 400)); |
| 149 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 150 |
# Make the first page dirty for system tablespace |
| 151 |
SET GLOBAL innodb_saved_page_number_debug = 0; |
| 152 |
SET GLOBAL innodb_fil_make_page_dirty_debug = 0; |
| 153 |
ERROR HY000: Lost connection to MySQL server during query |
| 154 |
# Make the first page (page_no=0) of the system tablespace |
| 155 |
# all zeroes. |
| 156 |
# restart |
| 157 |
CHECK TABLE t1; |
| 158 |
Table Op Msg_type Msg_text |
| 159 |
test.t1 check status OK |
| 160 |
SELECT f1, f2 FROM t1; |
| 161 |
f1 f2 |
| 162 |
1 ############ |
| 163 |
2 ++++++++++++ |
| 164 |
3 //////////// |
| 165 |
4 ------------ |
| 166 |
5 ............ |
| 167 |
# Test End |
| 168 |
# --------------------------------------------------------------- |
| 169 |
# Test Begin: Test if recovery works if first page of |
| 170 |
# system tablespace is corrupted. |
| 171 |
SET GLOBAL innodb_master_thread_disabled_debug=1; |
| 172 |
BEGIN; |
| 173 |
INSERT INTO t1 VALUES (6, repeat('%', 400)); |
| 174 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 175 |
# Make the first page dirty for system tablespace |
| 176 |
SET GLOBAL innodb_saved_page_number_debug = 0; |
| 177 |
SET GLOBAL innodb_fil_make_page_dirty_debug = 0; |
| 178 |
ERROR HY000: Lost connection to MySQL server during query |
| 179 |
# Corrupt the first page (page_no=0) of the system tablespace. |
| 180 |
# restart |
| 181 |
CHECK TABLE t1; |
| 182 |
Table Op Msg_type Msg_text |
| 183 |
test.t1 check status OK |
| 184 |
SELECT f1, f2 FROM t1; |
| 185 |
f1 f2 |
| 186 |
1 ############ |
| 187 |
2 ++++++++++++ |
| 188 |
3 //////////// |
| 189 |
4 ------------ |
| 190 |
5 ............ |
| 191 |
# Test End |
| 192 |
# --------------------------------------------------------------- |
| 193 |
# Test Begin: Test if recovery works if 2nd page of |
| 194 |
# system tablespace is full of zeroes. |
| 195 |
SET GLOBAL innodb_master_thread_disabled_debug=1; |
| 196 |
BEGIN; |
| 197 |
INSERT INTO t1 VALUES (6, repeat('%', 400)); |
| 198 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 199 |
# Make the second page dirty for system tablespace |
| 200 |
SET GLOBAL innodb_saved_page_number_debug = 1; |
| 201 |
SET GLOBAL innodb_fil_make_page_dirty_debug = 0; |
| 202 |
ERROR HY000: Lost connection to MySQL server during query |
| 203 |
# Make the 2nd page (page_no=1) of the system tablespace |
| 204 |
# all zeroes. |
| 205 |
# restart |
| 206 |
CHECK TABLE t1; |
| 207 |
Table Op Msg_type Msg_text |
| 208 |
test.t1 check status OK |
| 209 |
SELECT f1, f2 FROM t1; |
| 210 |
f1 f2 |
| 211 |
1 ############ |
| 212 |
2 ++++++++++++ |
| 213 |
3 //////////// |
| 214 |
4 ------------ |
| 215 |
5 ............ |
| 216 |
# Test End |
| 217 |
# --------------------------------------------------------------- |
| 218 |
# Test Begin: Test if recovery works if 2nd page of |
| 219 |
# system tablespace is corrupted. |
| 220 |
SET GLOBAL innodb_master_thread_disabled_debug=1; |
| 221 |
BEGIN; |
| 222 |
INSERT INTO t1 VALUES (6, repeat('%', 400)); |
| 223 |
SET GLOBAL innodb_checkpoint_disabled = 1; |
| 224 |
# Make the second page dirty for system tablespace |
| 225 |
SET GLOBAL innodb_saved_page_number_debug = 1; |
| 226 |
SET GLOBAL innodb_fil_make_page_dirty_debug = 0; |
| 227 |
ERROR HY000: Lost connection to MySQL server during query |
| 228 |
# Make the 2nd page (page_no=1) of the system tablespace |
| 229 |
# all zeroes. |
| 230 |
# restart |
| 231 |
CHECK TABLE t1; |
| 232 |
Table Op Msg_type Msg_text |
| 233 |
test.t1 check status OK |
| 234 |
SELECT f1, f2 FROM t1; |
| 235 |
f1 f2 |
| 236 |
1 ############ |
| 237 |
2 ++++++++++++ |
| 238 |
3 //////////// |
| 239 |
4 ------------ |
| 240 |
5 ............ |
| 241 |
# Test End |
| 242 |
# --------------------------------------------------------------- |
| 243 |
DROP TABLE t1; |