| 1 |
--source include/innodb_page_size_small.inc |
| 2 |
--source include/no_valgrind_without_big.inc |
| 3 |
|
| 4 |
let $have_debug_sync=`select count(*) = 1 from information_schema.session_variables where variable_name = 'debug_sync' and variable_value like 'on %'`; |
| 5 |
|
| 6 |
--echo # |
| 7 |
--echo # Bug #16963396 INNODB: USE OF LARGE EXTERNALLY-STORED FIELDS MAKES |
| 8 |
--echo # CRASH RECOVERY LOSE DATA |
| 9 |
--echo # |
| 10 |
|
| 11 |
# .......................................................................... |
| 12 |
|
| 13 |
--echo # |
| 14 |
--echo # Uncompressed Table - Insert Operation - Crash Test |
| 15 |
--echo # Fresh insert with blobs |
| 16 |
--echo # |
| 17 |
|
| 18 |
CREATE TABLE t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; |
| 19 |
|
| 20 |
# Insert a few rows (it doesn't really matter how many). These transactions |
| 21 |
# are committed once they are acked, so they should not be lost. |
| 22 |
INSERT INTO t1 (a, b) VALUES (1, repeat('^', 40000)); |
| 23 |
INSERT INTO t1 (a, b) VALUES (2, '2'); |
| 24 |
INSERT INTO t1 (a, b) VALUES (3, '3'); |
| 25 |
INSERT INTO t1 (a, b) VALUES (4, '4'); |
| 26 |
INSERT INTO t1 (a, b) VALUES (5, '5'); |
| 27 |
|
| 28 |
# The BLOB insert will fail, and should disappear. However no data committed |
| 29 |
# up to this point should be lost. |
| 30 |
begin; |
| 31 |
INSERT INTO t1 (a, b) VALUES (6, REPEAT('a', 4*1024*1024)); |
| 32 |
|
| 33 |
let $shutdown_timeout=0; |
| 34 |
let $restart_noprint=2; |
| 35 |
--source include/restart_mysqld.inc |
| 36 |
|
| 37 |
SELECT a, right(b, 50) FROM t1; |
| 38 |
|
| 39 |
# .......................................................................... |
| 40 |
|
| 41 |
--echo # |
| 42 |
--echo # Uncompressed Table - UPDATE Operation - Crash Test |
| 43 |
--echo # Update of non-blob column so that blob is needed. |
| 44 |
--echo # |
| 45 |
|
| 46 |
# The BLOB update will fail, and should disappear. However no data committed |
| 47 |
# up to this point should be lost. |
| 48 |
begin; |
| 49 |
UPDATE t1 set b = REPEAT('a', 4*1024*1024) where a = 5 ; |
| 50 |
|
| 51 |
let $shutdown_timeout=0; |
| 52 |
--source include/restart_mysqld.inc |
| 53 |
|
| 54 |
SELECT a, right(b, 50) FROM t1; |
| 55 |
|
| 56 |
# .......................................................................... |
| 57 |
|
| 58 |
--echo # |
| 59 |
--echo # Uncompressed Table - UPDATE Operation - Crash Test |
| 60 |
--echo # Update of blob column to blob. |
| 61 |
--echo # |
| 62 |
|
| 63 |
# The BLOB update will fail, and should disappear. However no data committed |
| 64 |
# up to this point should be lost. |
| 65 |
connect (con1,localhost,root,,); |
| 66 |
begin; |
| 67 |
UPDATE t1 set b = REPEAT('$', 50000) where a = 1; |
| 68 |
|
| 69 |
connection default; |
| 70 |
SET GLOBAL innodb_flush_log_at_trx_commit=1; |
| 71 |
UPDATE t1 SET b='five' WHERE a=5; |
| 72 |
|
| 73 |
let $shutdown_timeout=0; |
| 74 |
--source include/restart_mysqld.inc |
| 75 |
|
| 76 |
disconnect con1; |
| 77 |
|
| 78 |
SELECT a, right(b, 50) FROM t1; |
| 79 |
|
| 80 |
# .......................................................................... |
| 81 |
|
| 82 |
--echo # |
| 83 |
--echo # Uncompressed Table - Rollback of UPDATE operation |
| 84 |
--echo # Update moves offpage data to inline data. |
| 85 |
--echo # |
| 86 |
|
| 87 |
create table t2 (f1 bigint primary key, f2 longblob, f3 longblob, |
| 88 |
index(f2(10), f3(10))) engine=innodb; |
| 89 |
|
| 90 |
insert into t2 values (10, repeat('.', 40000), repeat('?', 40000)); |
| 91 |
|
| 92 |
connect (con1,localhost,root,,); |
| 93 |
begin; |
| 94 |
update t2 set f2 = '='; |
| 95 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 96 |
update t2 set f3 = '&'; |
| 97 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 98 |
|
| 99 |
if ($have_debug_sync) { |
| 100 |
--disable_query_log |
| 101 |
set DEBUG_SYNC='blob_rollback_middle SIGNAL stuck WAIT_FOR ever'; |
| 102 |
send ROLLBACK; |
| 103 |
--enable_query_log |
| 104 |
} |
| 105 |
|
| 106 |
connection default; |
| 107 |
if ($have_debug_sync) { |
| 108 |
--disable_query_log |
| 109 |
SET DEBUG_SYNC = 'now WAIT_FOR stuck'; |
| 110 |
--enable_query_log |
| 111 |
} |
| 112 |
SET GLOBAL innodb_flush_log_at_trx_commit=1; |
| 113 |
DELETE FROM t1 WHERE a=1; |
| 114 |
|
| 115 |
let $shutdown_timeout=0; |
| 116 |
--source include/restart_mysqld.inc |
| 117 |
|
| 118 |
disconnect con1; |
| 119 |
|
| 120 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 121 |
check table t2; |
| 122 |
drop table t2; |
| 123 |
|
| 124 |
# .......................................................................... |
| 125 |
|
| 126 |
--echo # |
| 127 |
--echo # Compressed Table - Insert Operation - Crash Test |
| 128 |
--echo # fresh insert with BLOBs |
| 129 |
--echo # |
| 130 |
|
| 131 |
set global innodb_compression_level = 0; |
| 132 |
|
| 133 |
create table t3 (f1 bigint primary key, f2 longblob, f3 longblob, |
| 134 |
index(f2(10), f3(10))) engine=innodb row_format=compressed; |
| 135 |
|
| 136 |
# The BLOB insert will fail, and should disappear. However no data committed |
| 137 |
# up to this point should be lost. |
| 138 |
connect (con1,localhost,root,,); |
| 139 |
begin; |
| 140 |
INSERT INTO t3 (f1, f2, f3) VALUES (6, repeat('/', 40000), repeat('<', 40000)); |
| 141 |
|
| 142 |
connection default; |
| 143 |
SET GLOBAL innodb_flush_log_at_trx_commit=1; |
| 144 |
DELETE FROM t1 WHERE a=2; |
| 145 |
|
| 146 |
let $shutdown_timeout=0; |
| 147 |
--source include/restart_mysqld.inc |
| 148 |
|
| 149 |
disconnect con1; |
| 150 |
|
| 151 |
select f1, length(f2), length(f3) from t3; |
| 152 |
select f1, right(f2, 30), right(f3, 20) from t3; |
| 153 |
check table t3; |
| 154 |
|
| 155 |
# .......................................................................... |
| 156 |
|
| 157 |
--echo # |
| 158 |
--echo # Compressed Table - Update Operation - Crash Test |
| 159 |
--echo # update of a non-BLOB column so that BLOB is needed |
| 160 |
--echo # |
| 161 |
|
| 162 |
set global innodb_compression_level = 0; |
| 163 |
insert into t3 values (2, repeat('!', 30), repeat('+', 30)); |
| 164 |
|
| 165 |
# The BLOB update will fail, and should disappear. However no data committed |
| 166 |
# up to this point should be lost. |
| 167 |
connect (con1,localhost,root,,); |
| 168 |
begin; |
| 169 |
UPDATE t3 set f2 = repeat('>', 40000) where f1 = 2; |
| 170 |
|
| 171 |
connection default; |
| 172 |
SET GLOBAL innodb_flush_log_at_trx_commit=1; |
| 173 |
DELETE FROM t1 WHERE a=3; |
| 174 |
|
| 175 |
let $shutdown_timeout=0; |
| 176 |
--source include/restart_mysqld.inc |
| 177 |
|
| 178 |
disconnect con1; |
| 179 |
|
| 180 |
select f1, length(f2), length(f3) from t3; |
| 181 |
select f1, right(f2, 30), right(f3, 20) from t3; |
| 182 |
check table t3; |
| 183 |
|
| 184 |
# .......................................................................... |
| 185 |
|
| 186 |
--echo # |
| 187 |
--echo # Compressed Table - Update Operation - Crash Test |
| 188 |
--echo # update blob to blob |
| 189 |
--echo # |
| 190 |
|
| 191 |
set global innodb_compression_level = 0; |
| 192 |
insert into t3 values (3, repeat('%', 40000), repeat('~', 40000)); |
| 193 |
|
| 194 |
# The BLOB update will fail, and should disappear. However no data committed |
| 195 |
# up to this point should be lost. |
| 196 |
connect (con1,localhost,root,,); |
| 197 |
begin; |
| 198 |
UPDATE t3 set f2 = concat(f2, repeat(',', 10)) where f1 = 3; |
| 199 |
|
| 200 |
connection default; |
| 201 |
SET GLOBAL innodb_flush_log_at_trx_commit=1; |
| 202 |
DELETE FROM t1 WHERE a=4; |
| 203 |
|
| 204 |
let $shutdown_timeout=0; |
| 205 |
--source include/restart_mysqld.inc |
| 206 |
|
| 207 |
select f1, length(f2), length(f3) from t3; |
| 208 |
select f1, right(f2, 30), right(f3, 20) from t3; |
| 209 |
check table t3; |
| 210 |
|
| 211 |
DROP TABLE t1,t3; |