| 1 |
# |
| 2 |
# Bug #16963396 INNODB: USE OF LARGE EXTERNALLY-STORED FIELDS MAKES |
| 3 |
# CRASH RECOVERY LOSE DATA |
| 4 |
# |
| 5 |
# |
| 6 |
# Uncompressed Table - Insert Operation - Crash Test |
| 7 |
# Fresh insert with blobs |
| 8 |
# |
| 9 |
CREATE TABLE t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; |
| 10 |
INSERT INTO t1 (a, b) VALUES (1, repeat('^', 40000)); |
| 11 |
INSERT INTO t1 (a, b) VALUES (2, '2'); |
| 12 |
INSERT INTO t1 (a, b) VALUES (3, '3'); |
| 13 |
INSERT INTO t1 (a, b) VALUES (4, '4'); |
| 14 |
INSERT INTO t1 (a, b) VALUES (5, '5'); |
| 15 |
begin; |
| 16 |
INSERT INTO t1 (a, b) VALUES (6, REPEAT('a', 4*1024*1024)); |
| 17 |
# Kill and restart |
| 18 |
SELECT a, right(b, 50) FROM t1; |
| 19 |
a right(b, 50) |
| 20 |
1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 21 |
2 2 |
| 22 |
3 3 |
| 23 |
4 4 |
| 24 |
5 5 |
| 25 |
# |
| 26 |
# Uncompressed Table - UPDATE Operation - Crash Test |
| 27 |
# Update of non-blob column so that blob is needed. |
| 28 |
# |
| 29 |
begin; |
| 30 |
UPDATE t1 set b = REPEAT('a', 4*1024*1024) where a = 5 ; |
| 31 |
# Kill and restart |
| 32 |
SELECT a, right(b, 50) FROM t1; |
| 33 |
a right(b, 50) |
| 34 |
1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 35 |
2 2 |
| 36 |
3 3 |
| 37 |
4 4 |
| 38 |
5 5 |
| 39 |
# |
| 40 |
# Uncompressed Table - UPDATE Operation - Crash Test |
| 41 |
# Update of blob column to blob. |
| 42 |
# |
| 43 |
begin; |
| 44 |
UPDATE t1 set b = REPEAT('$', 50000) where a = 1 ; |
| 45 |
# Kill and restart |
| 46 |
SELECT a, right(b, 50) FROM t1; |
| 47 |
a right(b, 50) |
| 48 |
1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 49 |
2 2 |
| 50 |
3 3 |
| 51 |
4 4 |
| 52 |
5 5 |
| 53 |
DROP TABLE t1; |
| 54 |
# |
| 55 |
# Uncompressed Table - Rollback of UPDATE operation |
| 56 |
# Update moves offpage data to inline data. |
| 57 |
# |
| 58 |
create table t2 (f1 bigint primary key, f2 longblob, f3 longblob, |
| 59 |
index(f2(10), f3(10))) engine=innodb; |
| 60 |
insert into t2 values (10, repeat('.', 40000), repeat('?', 40000)); |
| 61 |
start transaction; |
| 62 |
update t2 set f2 = '='; |
| 63 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 64 |
f1 right(f2, 20) right(f3, 20) |
| 65 |
10 = ???????????????????? |
| 66 |
update t2 set f3 = '&'; |
| 67 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 68 |
f1 right(f2, 20) right(f3, 20) |
| 69 |
10 = & |
| 70 |
set session debug='d,ib_blob_update_rollback'; |
| 71 |
rollback; |
| 72 |
ERROR HY000: Lost connection to MySQL server during query |
| 73 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 74 |
f1 right(f2, 20) right(f3, 20) |
| 75 |
10 .................... ???????????????????? |
| 76 |
check table t2; |
| 77 |
Table Op Msg_type Msg_text |
| 78 |
test.t2 check status OK |
| 79 |
# |
| 80 |
# Uncompressed Table - Rollback of UPDATE operation |
| 81 |
# |
| 82 |
insert into t2 values (20, repeat('.', 40000), repeat('?', 40000)); |
| 83 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 84 |
f1 right(f2, 20) right(f3, 20) |
| 85 |
10 .................... ???????????????????? |
| 86 |
20 .................... ???????????????????? |
| 87 |
start transaction; |
| 88 |
update t2 set f2 = repeat('$', 60000) where f1 = 20; |
| 89 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 90 |
f1 right(f2, 20) right(f3, 20) |
| 91 |
10 .................... ???????????????????? |
| 92 |
20 $$$$$$$$$$$$$$$$$$$$ ???????????????????? |
| 93 |
SET GLOBAL innodb_log_checkpoint_now=ON; |
| 94 |
# Kill the server |
| 95 |
# Starting server with --innodb-force-recovery-crash=99 |
| 96 |
Pattern "innodb_force_recovery_crash=99" found |
| 97 |
# restart |
| 98 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 99 |
f1 right(f2, 20) right(f3, 20) |
| 100 |
10 .................... ???????????????????? |
| 101 |
20 .................... ???????????????????? |
| 102 |
check table t2; |
| 103 |
Table Op Msg_type Msg_text |
| 104 |
test.t2 check status OK |
| 105 |
drop table t2; |
| 106 |
# |
| 107 |
# Compressed Table - Insert Operation - Crash Test |
| 108 |
# fresh insert with BLOBs |
| 109 |
# |
| 110 |
set global innodb_compression_level = 0; |
| 111 |
create table t3 (f1 bigint primary key, f2 longblob, f3 longblob, |
| 112 |
index(f2(10), f3(10))) engine=innodb row_format=compressed; |
| 113 |
# Kill and restart |
| 114 |
select f1, length(f2), length(f3) from t3; |
| 115 |
f1 length(f2) length(f3) |
| 116 |
select f1, right(f2, 30), right(f3, 20) from t3; |
| 117 |
f1 right(f2, 30) right(f3, 20) |
| 118 |
check table t3; |
| 119 |
Table Op Msg_type Msg_text |
| 120 |
test.t3 check status OK |
| 121 |
# |
| 122 |
# Compressed Table - Update Operation - Crash Test |
| 123 |
# update of a non-BLOB column so that BLOB is needed |
| 124 |
# |
| 125 |
set global innodb_compression_level = 0; |
| 126 |
insert into t3 values (2, repeat('!', 30), repeat('+', 30)); |
| 127 |
begin; |
| 128 |
UPDATE t3 set f2 = repeat('>', 40000) where f1 = 2; |
| 129 |
# Kill and restart |
| 130 |
select f1, length(f2), length(f3) from t3; |
| 131 |
f1 length(f2) length(f3) |
| 132 |
2 30 30 |
| 133 |
select f1, right(f2, 30), right(f3, 20) from t3; |
| 134 |
f1 right(f2, 30) right(f3, 20) |
| 135 |
2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ++++++++++++++++++++ |
| 136 |
check table t3; |
| 137 |
Table Op Msg_type Msg_text |
| 138 |
test.t3 check status OK |
| 139 |
# |
| 140 |
# Compressed Table - Update Operation - Crash Test |
| 141 |
# update blob to blob |
| 142 |
# |
| 143 |
set global innodb_compression_level = 0; |
| 144 |
insert into t3 values (3, repeat('%', 40000), repeat('~', 40000)); |
| 145 |
begin; |
| 146 |
UPDATE t3 set f2 = concat(f2, repeat(',', 10)) where f1 = 3; |
| 147 |
# Kill and restart |
| 148 |
select f1, length(f2), length(f3) from t3; |
| 149 |
f1 length(f2) length(f3) |
| 150 |
2 30 30 |
| 151 |
3 40000 40000 |
| 152 |
select f1, right(f2, 30), right(f3, 20) from t3; |
| 153 |
f1 right(f2, 30) right(f3, 20) |
| 154 |
2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ++++++++++++++++++++ |
| 155 |
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ~~~~~~~~~~~~~~~~~~~~ |
| 156 |
check table t3; |
| 157 |
Table Op Msg_type Msg_text |
| 158 |
test.t3 check status OK |
| 159 |
DROP TABLE t3; |