| 1 |
--source include/not_crashrep.inc |
| 2 |
--source include/not_valgrind.inc |
| 3 |
--source include/have_debug.inc |
| 4 |
--source include/have_innodb_max_16k.inc |
| 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 |
connection default; |
| 12 |
|
| 13 |
# .......................................................................... |
| 14 |
|
| 15 |
--echo # |
| 16 |
--echo # Uncompressed Table - Insert Operation - Crash Test |
| 17 |
--echo # Fresh insert with blobs |
| 18 |
--echo # |
| 19 |
|
| 20 |
CREATE TABLE t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB; |
| 21 |
|
| 22 |
# Insert a few rows (it doesn't really matter how many). These transactions |
| 23 |
# are committed once they are acked, so they should not be lost. |
| 24 |
INSERT INTO t1 (a, b) VALUES (1, repeat('^', 40000)); |
| 25 |
INSERT INTO t1 (a, b) VALUES (2, '2'); |
| 26 |
INSERT INTO t1 (a, b) VALUES (3, '3'); |
| 27 |
INSERT INTO t1 (a, b) VALUES (4, '4'); |
| 28 |
INSERT INTO t1 (a, b) VALUES (5, '5'); |
| 29 |
|
| 30 |
# The BLOB insert will fail, and should disappear. However no data committed |
| 31 |
# up to this point should be lost. |
| 32 |
begin; |
| 33 |
INSERT INTO t1 (a, b) VALUES (6, REPEAT('a', 4*1024*1024)); |
| 34 |
|
| 35 |
--source include/kill_and_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 |
--source include/kill_and_restart_mysqld.inc |
| 52 |
|
| 53 |
SELECT a, right(b, 50) FROM t1; |
| 54 |
|
| 55 |
# .......................................................................... |
| 56 |
|
| 57 |
--echo # |
| 58 |
--echo # Uncompressed Table - UPDATE Operation - Crash Test |
| 59 |
--echo # Update of blob column to blob. |
| 60 |
--echo # |
| 61 |
|
| 62 |
# The BLOB update will fail, and should disappear. However no data committed |
| 63 |
# up to this point should be lost. |
| 64 |
begin; |
| 65 |
UPDATE t1 set b = REPEAT('$', 50000) where a = 1 ; |
| 66 |
|
| 67 |
--source include/kill_and_restart_mysqld.inc |
| 68 |
|
| 69 |
SELECT a, right(b, 50) FROM t1; |
| 70 |
|
| 71 |
# Clean up. |
| 72 |
DROP TABLE t1; |
| 73 |
|
| 74 |
# .......................................................................... |
| 75 |
|
| 76 |
--echo # |
| 77 |
--echo # Uncompressed Table - Rollback of UPDATE operation |
| 78 |
--echo # Update moves offpage data to inline data. |
| 79 |
--echo # |
| 80 |
|
| 81 |
create table t2 (f1 bigint primary key, f2 longblob, f3 longblob, |
| 82 |
index(f2(10), f3(10))) engine=innodb; |
| 83 |
|
| 84 |
insert into t2 values (10, repeat('.', 40000), repeat('?', 40000)); |
| 85 |
|
| 86 |
start transaction; |
| 87 |
update t2 set f2 = '='; |
| 88 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 89 |
update t2 set f3 = '&'; |
| 90 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 91 |
|
| 92 |
set session debug='d,ib_blob_update_rollback'; |
| 93 |
# We expect a restart. |
| 94 |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 95 |
--error 2013 |
| 96 |
rollback; |
| 97 |
|
| 98 |
# Wait for the server to come back up, and reconnect. |
| 99 |
--enable_reconnect |
| 100 |
--source include/wait_until_connected_again.inc |
| 101 |
|
| 102 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 103 |
check table t2; |
| 104 |
|
| 105 |
# .......................................................................... |
| 106 |
|
| 107 |
--echo # |
| 108 |
--echo # Uncompressed Table - Rollback of UPDATE operation |
| 109 |
--echo # |
| 110 |
|
| 111 |
insert into t2 values (20, repeat('.', 40000), repeat('?', 40000)); |
| 112 |
|
| 113 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 114 |
|
| 115 |
start transaction; |
| 116 |
update t2 set f2 = repeat('$', 60000) where f1 = 20; |
| 117 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 118 |
|
| 119 |
SET GLOBAL innodb_log_checkpoint_now=ON; |
| 120 |
|
| 121 |
--source include/kill_mysqld.inc |
| 122 |
|
| 123 |
--echo # Starting server with --innodb-force-recovery-crash=99 |
| 124 |
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/my_restart.err; |
| 125 |
let args = --loose-console --core-file > $SEARCH_FILE 2>&1; |
| 126 |
let crash = $args --innodb-force-recovery-crash; |
| 127 |
|
| 128 |
--error 3 |
| 129 |
--exec $MYSQLD_CMD $crash=99 |
| 130 |
|
| 131 |
let SEARCH_PATTERN = innodb_force_recovery_crash=99; |
| 132 |
--source include/search_pattern.inc |
| 133 |
|
| 134 |
--source include/start_mysqld.inc |
| 135 |
|
| 136 |
select f1, right(f2, 20), right(f3, 20) from t2; |
| 137 |
check table t2; |
| 138 |
drop table t2; |
| 139 |
|
| 140 |
# .......................................................................... |
| 141 |
|
| 142 |
--echo # |
| 143 |
--echo # Compressed Table - Insert Operation - Crash Test |
| 144 |
--echo # fresh insert with BLOBs |
| 145 |
--echo # |
| 146 |
|
| 147 |
connection default; |
| 148 |
|
| 149 |
set global innodb_compression_level = 0; |
| 150 |
|
| 151 |
create table t3 (f1 bigint primary key, f2 longblob, f3 longblob, |
| 152 |
index(f2(10), f3(10))) engine=innodb row_format=compressed; |
| 153 |
|
| 154 |
# The BLOB insert will fail, and should disappear. However no data committed |
| 155 |
# up to this point should be lost. |
| 156 |
--disable_query_log |
| 157 |
begin; |
| 158 |
INSERT INTO t3 (f1, f2, f3) VALUES (6, repeat('/', 40000), repeat('<', 40000)); |
| 159 |
--enable_query_log |
| 160 |
|
| 161 |
--source include/kill_and_restart_mysqld.inc |
| 162 |
|
| 163 |
select f1, length(f2), length(f3) from t3; |
| 164 |
select f1, right(f2, 30), right(f3, 20) from t3; |
| 165 |
check table t3; |
| 166 |
|
| 167 |
# .......................................................................... |
| 168 |
|
| 169 |
--echo # |
| 170 |
--echo # Compressed Table - Update Operation - Crash Test |
| 171 |
--echo # update of a non-BLOB column so that BLOB is needed |
| 172 |
--echo # |
| 173 |
|
| 174 |
set global innodb_compression_level = 0; |
| 175 |
insert into t3 values (2, repeat('!', 30), repeat('+', 30)); |
| 176 |
|
| 177 |
# The BLOB update will fail, and should disappear. However no data committed |
| 178 |
# up to this point should be lost. |
| 179 |
begin; |
| 180 |
UPDATE t3 set f2 = repeat('>', 40000) where f1 = 2; |
| 181 |
|
| 182 |
--source include/kill_and_restart_mysqld.inc |
| 183 |
|
| 184 |
select f1, length(f2), length(f3) from t3; |
| 185 |
select f1, right(f2, 30), right(f3, 20) from t3; |
| 186 |
check table t3; |
| 187 |
|
| 188 |
# .......................................................................... |
| 189 |
|
| 190 |
--echo # |
| 191 |
--echo # Compressed Table - Update Operation - Crash Test |
| 192 |
--echo # update blob to blob |
| 193 |
--echo # |
| 194 |
|
| 195 |
set global innodb_compression_level = 0; |
| 196 |
insert into t3 values (3, repeat('%', 40000), repeat('~', 40000)); |
| 197 |
|
| 198 |
# The BLOB update will fail, and should disappear. However no data committed |
| 199 |
# up to this point should be lost. |
| 200 |
begin; |
| 201 |
UPDATE t3 set f2 = concat(f2, repeat(',', 10)) where f1 = 3; |
| 202 |
|
| 203 |
--source include/kill_and_restart_mysqld.inc |
| 204 |
|
| 205 |
select f1, length(f2), length(f3) from t3; |
| 206 |
select f1, right(f2, 30), right(f3, 20) from t3; |
| 207 |
check table t3; |
| 208 |
|
| 209 |
# Clean up. |
| 210 |
DROP TABLE t3; |
| 211 |
|