| 1 |
call mtr.add_suppression("File '.*aria_log.000.*' not found \\(Errcode: 2 .*\\)"); |
| 2 |
call mtr.add_suppression("Table '.\/mysqltest\/t_corrupted1' is crashed, skipping it. Please repair it with aria_chk -r"); |
| 3 |
set global aria_log_file_size=4294959104; |
| 4 |
drop database if exists mysqltest; |
| 5 |
create database mysqltest; |
| 6 |
connect admin, 127.0.0.1, root,,mysqltest,,; |
| 7 |
connection default; |
| 8 |
use mysqltest; |
| 9 |
* TEST of removing logs manually |
| 10 |
connection default; |
| 11 |
connection admin; |
| 12 |
* shut down mysqld, removed logs, restarted it |
| 13 |
connection default; |
| 14 |
* TEST of UNDO_ROW_DELETE preserving rowid |
| 15 |
create table t1(a int) engine=aria; |
| 16 |
insert into t1 values(1),(2); |
| 17 |
connection admin; |
| 18 |
flush table t1; |
| 19 |
* copied t1 for comparison |
| 20 |
connection default; |
| 21 |
lock tables t1 write; |
| 22 |
insert into t1 values(3); |
| 23 |
delete from t1 where a in (1,2,3); |
| 24 |
connection admin; |
| 25 |
SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_crash"; |
| 26 |
* crashing mysqld intentionally |
| 27 |
set global aria_checkpoint_interval=1; |
| 28 |
ERROR HY000: Lost connection to server during query |
| 29 |
* recovery happens |
| 30 |
check table t1 extended; |
| 31 |
Table Op Msg_type Msg_text |
| 32 |
mysqltest.t1 check status OK |
| 33 |
* testing that checksum after recovery is as expected |
| 34 |
Checksum-check |
| 35 |
ok |
| 36 |
connection default; |
| 37 |
use mysqltest; |
| 38 |
drop table t1; |
| 39 |
* TEST of checkpoint |
| 40 |
set global debug_dbug="+d,info,query,enter,exit,loop,maria_checkpoint_indirect"; |
| 41 |
set global aria_checkpoint_interval=10000; |
| 42 |
create table t1(a int, b varchar(10), index(a,b)) engine=aria; |
| 43 |
insert into t1 values(1,"a"),(2,"b"),(3,"c"); |
| 44 |
delete from t1 where b="b"; |
| 45 |
update t1 set b="d" where a=1; |
| 46 |
connection admin; |
| 47 |
flush table t1; |
| 48 |
* copied t1 for comparison |
| 49 |
connection default; |
| 50 |
lock tables t1 write; |
| 51 |
insert into t1 values(4,"e"),(5,"f"),(6,"g"); |
| 52 |
update t1 set b="h" where a=5; |
| 53 |
delete from t1 where b="g"; |
| 54 |
show status like "Aria_pagecache_blocks_not_flushed"; |
| 55 |
Variable_name Value |
| 56 |
Aria_pagecache_blocks_not_flushed 3 |
| 57 |
set global aria_checkpoint_interval=10000; |
| 58 |
update t1 set b="i" where a=5; |
| 59 |
connection admin; |
| 60 |
SET SESSION debug_dbug="+d,maria_crash"; |
| 61 |
* crashing mysqld intentionally |
| 62 |
set global aria_checkpoint_interval=1; |
| 63 |
ERROR HY000: Lost connection to server during query |
| 64 |
* recovery happens |
| 65 |
check table t1 extended; |
| 66 |
Table Op Msg_type Msg_text |
| 67 |
mysqltest.t1 check status OK |
| 68 |
* testing that checksum after recovery is as expected |
| 69 |
Checksum-check |
| 70 |
ok |
| 71 |
connection default; |
| 72 |
use mysqltest; |
| 73 |
drop table t1; |
| 74 |
Test of REPAIR's implicit commit |
| 75 |
create table t1 (a varchar(100), key(a)) engine=aria; |
| 76 |
insert into t1 values(3); |
| 77 |
connection admin; |
| 78 |
flush table t1; |
| 79 |
* copied t1 for comparison |
| 80 |
connection default; |
| 81 |
lock tables t1 write; |
| 82 |
insert into t1 values (1); |
| 83 |
repair table t1; |
| 84 |
Table Op Msg_type Msg_text |
| 85 |
mysqltest.t1 repair status OK |
| 86 |
insert into t1 values(2); |
| 87 |
select * from t1; |
| 88 |
a |
| 89 |
1 |
| 90 |
2 |
| 91 |
3 |
| 92 |
connection admin; |
| 93 |
SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_flush_whole_page_cache,maria_crash"; |
| 94 |
* crashing mysqld intentionally |
| 95 |
set global aria_checkpoint_interval=1; |
| 96 |
ERROR HY000: Lost connection to server during query |
| 97 |
* recovery happens |
| 98 |
check table t1 extended; |
| 99 |
Table Op Msg_type Msg_text |
| 100 |
mysqltest.t1 check status OK |
| 101 |
* testing that checksum after recovery is as expected |
| 102 |
Checksum-check |
| 103 |
failure |
| 104 |
connection default; |
| 105 |
use mysqltest; |
| 106 |
select * from t1; |
| 107 |
a |
| 108 |
1 |
| 109 |
3 |
| 110 |
drop table t1; |
| 111 |
* TEST of recovery when crash before bulk-insert-with-repair is committed |
| 112 |
create table t1 (a varchar(100), key(a)) engine=aria; |
| 113 |
create table t2 (a varchar(100)) engine=myisam; |
| 114 |
set rand_seed1=12, rand_seed2=254; |
| 115 |
insert into t2 values (rand()); |
| 116 |
insert into t2 select (rand()) from t2; |
| 117 |
insert into t2 select (rand()) from t2; |
| 118 |
insert into t2 select (rand()) from t2; |
| 119 |
insert into t2 select (rand()) from t2; |
| 120 |
insert into t2 select (rand()) from t2; |
| 121 |
insert into t2 select (rand()) from t2; |
| 122 |
insert into t1 values(30); |
| 123 |
connection admin; |
| 124 |
flush table t1; |
| 125 |
* copied t1 for comparison |
| 126 |
connection default; |
| 127 |
lock tables t1 write, t2 read; |
| 128 |
delete from t1 limit 1; |
| 129 |
select count(*) from t1; |
| 130 |
count(*) |
| 131 |
0 |
| 132 |
insert into t1 select * from t2; |
| 133 |
connection admin; |
| 134 |
SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_flush_whole_page_cache,maria_crash"; |
| 135 |
* crashing mysqld intentionally |
| 136 |
set global aria_checkpoint_interval=1; |
| 137 |
ERROR HY000: Lost connection to server during query |
| 138 |
* recovery happens |
| 139 |
check table t1 extended; |
| 140 |
Table Op Msg_type Msg_text |
| 141 |
mysqltest.t1 check status OK |
| 142 |
* testing that checksum after recovery is as expected |
| 143 |
Checksum-check |
| 144 |
ok |
| 145 |
connection default; |
| 146 |
use mysqltest; |
| 147 |
show keys from t1; |
| 148 |
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored |
| 149 |
t1 1 a 1 a A 1 NULL NULL YES BTREE NO |
| 150 |
select count(*) from t1; |
| 151 |
count(*) |
| 152 |
1 |
| 153 |
drop table t1; |
| 154 |
* TEST of recovery when OPTIMIZE has replaced the index file and crash |
| 155 |
create table t_corrupted1 (a varchar(100), key(a)) engine=aria; |
| 156 |
insert into t_corrupted1 select (rand()) from t2; |
| 157 |
connection admin; |
| 158 |
flush table t_corrupted1; |
| 159 |
* copied t_corrupted1 for comparison |
| 160 |
connection default; |
| 161 |
connection admin; |
| 162 |
SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_flush_whole_page_cache,maria_crash_sort_index"; |
| 163 |
* crashing mysqld intentionally |
| 164 |
optimize table t_corrupted1; |
| 165 |
ERROR HY000: Lost connection to server during query |
| 166 |
* recovery happens |
| 167 |
check table t_corrupted1 extended; |
| 168 |
Table Op Msg_type Msg_text |
| 169 |
mysqltest.t_corrupted1 check warning Last repair was aborted before finishing |
| 170 |
mysqltest.t_corrupted1 check status OK |
| 171 |
* testing that checksum after recovery is as expected |
| 172 |
Checksum-check |
| 173 |
ok |
| 174 |
connection default; |
| 175 |
use mysqltest; |
| 176 |
drop table t_corrupted1, t2; |
| 177 |
drop database mysqltest_for_comparison; |
| 178 |
drop database mysqltest; |