| 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 |
SELECT a, right(b, 50) FROM t1; |
| 18 |
a right(b, 50) |
| 19 |
1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 20 |
2 2 |
| 21 |
3 3 |
| 22 |
4 4 |
| 23 |
5 5 |
| 24 |
# |
| 25 |
# Uncompressed Table - UPDATE Operation - Crash Test |
| 26 |
# Update of non-blob column so that blob is needed. |
| 27 |
# |
| 28 |
begin; |
| 29 |
UPDATE t1 set b = REPEAT('a', 4*1024*1024) where a = 5 ; |
| 30 |
SELECT a, right(b, 50) FROM t1; |
| 31 |
a right(b, 50) |
| 32 |
1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 33 |
2 2 |
| 34 |
3 3 |
| 35 |
4 4 |
| 36 |
5 5 |
| 37 |
# |
| 38 |
# Uncompressed Table - UPDATE Operation - Crash Test |
| 39 |
# Update of blob column to blob. |
| 40 |
# |
| 41 |
connect con1,localhost,root,,; |
| 42 |
begin; |
| 43 |
UPDATE t1 set b = REPEAT('$', 50000) where a = 1; |
| 44 |
connection default; |
| 45 |
SET GLOBAL innodb_flush_log_at_trx_commit=1; |
| 46 |
UPDATE t1 SET b='five' WHERE a=5; |
| 47 |
disconnect con1; |
| 48 |
SELECT a, right(b, 50) FROM t1; |
| 49 |
a right(b, 50) |
| 50 |
1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 51 |
2 2 |
| 52 |
3 3 |
| 53 |
4 4 |
| 54 |
5 five |
| 55 |
# |
| 56 |
# Uncompressed Table - Rollback of UPDATE operation |
| 57 |
# Update moves offpage data to inline data. |
| 58 |
# |
| 59 |
create table t2 (f1 bigint primary key, f2 longblob, f3 longblob, |
| 60 |
index(f2(10), f3(10))) engine=innodb; |
| 61 |
insert into t2 values (10, repeat('.', 40000), repeat('?', 40000)); |
| 62 |
connect con1,localhost,root,,; |
| 63 |
begin; |
| 64 |
update t2 set f2 = '='; |
| 65 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 66 |
f1 right(f2, 20) right(f3, 20) |
| 67 |
10 = ???????????????????? |
| 68 |
update t2 set f3 = '&'; |
| 69 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 70 |
f1 right(f2, 20) right(f3, 20) |
| 71 |
10 = & |
| 72 |
connection default; |
| 73 |
SET GLOBAL innodb_flush_log_at_trx_commit=1; |
| 74 |
DELETE FROM t1 WHERE a=1; |
| 75 |
disconnect con1; |
| 76 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 77 |
f1 right(f2, 20) right(f3, 20) |
| 78 |
10 .................... ???????????????????? |
| 79 |
check table t2; |
| 80 |
Table Op Msg_type Msg_text |
| 81 |
test.t2 check status OK |
| 82 |
drop table t2; |
| 83 |
# |
| 84 |
# Compressed Table - Insert Operation - Crash Test |
| 85 |
# fresh insert with BLOBs |
| 86 |
# |
| 87 |
set global innodb_compression_level = 0; |
| 88 |
create table t3 (f1 bigint primary key, f2 longblob, f3 longblob, |
| 89 |
index(f2(10), f3(10))) engine=innodb row_format=compressed; |
| 90 |
connect con1,localhost,root,,; |
| 91 |
begin; |
| 92 |
INSERT INTO t3 (f1, f2, f3) VALUES (6, repeat('/', 40000), repeat('<', 40000)); |
| 93 |
connection default; |
| 94 |
SET GLOBAL innodb_flush_log_at_trx_commit=1; |
| 95 |
DELETE FROM t1 WHERE a=2; |
| 96 |
disconnect con1; |
| 97 |
select f1, length(f2), length(f3) from t3; |
| 98 |
f1 length(f2) length(f3) |
| 99 |
select f1, right(f2, 30), right(f3, 20) from t3; |
| 100 |
f1 right(f2, 30) right(f3, 20) |
| 101 |
check table t3; |
| 102 |
Table Op Msg_type Msg_text |
| 103 |
test.t3 check status OK |
| 104 |
# |
| 105 |
# Compressed Table - Update Operation - Crash Test |
| 106 |
# update of a non-BLOB column so that BLOB is needed |
| 107 |
# |
| 108 |
set global innodb_compression_level = 0; |
| 109 |
insert into t3 values (2, repeat('!', 30), repeat('+', 30)); |
| 110 |
connect con1,localhost,root,,; |
| 111 |
begin; |
| 112 |
UPDATE t3 set f2 = repeat('>', 40000) where f1 = 2; |
| 113 |
connection default; |
| 114 |
SET GLOBAL innodb_flush_log_at_trx_commit=1; |
| 115 |
DELETE FROM t1 WHERE a=3; |
| 116 |
disconnect con1; |
| 117 |
select f1, length(f2), length(f3) from t3; |
| 118 |
f1 length(f2) length(f3) |
| 119 |
2 30 30 |
| 120 |
select f1, right(f2, 30), right(f3, 20) from t3; |
| 121 |
f1 right(f2, 30) right(f3, 20) |
| 122 |
2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ++++++++++++++++++++ |
| 123 |
check table t3; |
| 124 |
Table Op Msg_type Msg_text |
| 125 |
test.t3 check status OK |
| 126 |
# |
| 127 |
# Compressed Table - Update Operation - Crash Test |
| 128 |
# update blob to blob |
| 129 |
# |
| 130 |
set global innodb_compression_level = 0; |
| 131 |
insert into t3 values (3, repeat('%', 40000), repeat('~', 40000)); |
| 132 |
connect con1,localhost,root,,; |
| 133 |
begin; |
| 134 |
UPDATE t3 set f2 = concat(f2, repeat(',', 10)) where f1 = 3; |
| 135 |
connection default; |
| 136 |
SET GLOBAL innodb_flush_log_at_trx_commit=1; |
| 137 |
DELETE FROM t1 WHERE a=4; |
| 138 |
select f1, length(f2), length(f3) from t3; |
| 139 |
f1 length(f2) length(f3) |
| 140 |
2 30 30 |
| 141 |
3 40000 40000 |
| 142 |
select f1, right(f2, 30), right(f3, 20) from t3; |
| 143 |
f1 right(f2, 30) right(f3, 20) |
| 144 |
2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ++++++++++++++++++++ |
| 145 |
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ~~~~~~~~~~~~~~~~~~~~ |
| 146 |
check table t3; |
| 147 |
Table Op Msg_type Msg_text |
| 148 |
test.t3 check status OK |
| 149 |
DROP TABLE t1,t3; |