| 1 |
create table t1(f1 int not null, f2 int not null, index idx(f2))engine=innodb; |
| 2 |
create table t2(f1 int primary key, f2 int, index idx(f2))engine=innodb; |
| 3 |
insert into t1 values(1, 2); |
| 4 |
insert into t2 values(1, 2); |
| 5 |
SET GLOBAL innodb_fast_shutdown = 0; |
| 6 |
# restart: --innodb-force-recovery=4 |
| 7 |
select variable_name,variable_value from information_schema.global_status |
| 8 |
WHERE variable_name LIKE 'innodb_buffer_pool_%_requests'; |
| 9 |
variable_name variable_value |
| 10 |
INNODB_BUFFER_POOL_READ_REQUESTS 0 |
| 11 |
INNODB_BUFFER_POOL_WRITE_REQUESTS 0 |
| 12 |
select * from t1; |
| 13 |
f1 f2 |
| 14 |
1 2 |
| 15 |
select variable_name from information_schema.global_status |
| 16 |
WHERE variable_name LIKE 'innodb_buffer_pool_%_requests' and variable_value>0; |
| 17 |
variable_name |
| 18 |
INNODB_BUFFER_POOL_READ_REQUESTS |
| 19 |
begin; |
| 20 |
insert into t1 values(2, 3); |
| 21 |
rollback; |
| 22 |
select variable_name from information_schema.global_status |
| 23 |
WHERE variable_name LIKE 'innodb_buffer_pool_%_requests' and variable_value>0; |
| 24 |
variable_name |
| 25 |
INNODB_BUFFER_POOL_READ_REQUESTS |
| 26 |
INNODB_BUFFER_POOL_WRITE_REQUESTS |
| 27 |
alter table t1 add f3 int not null, algorithm=copy; |
| 28 |
alter table t1 add f4 int not null, algorithm=inplace; |
| 29 |
drop index idx on t1; |
| 30 |
update t1 set f1=3 where f2=2; |
| 31 |
create table t3(f1 int not null)engine=innodb; |
| 32 |
drop table t3; |
| 33 |
rename table t1 to t3; |
| 34 |
rename table t3 to t1; |
| 35 |
truncate table t1; |
| 36 |
show tables; |
| 37 |
Tables_in_test |
| 38 |
t1 |
| 39 |
t2 |
| 40 |
# restart: --innodb-force-recovery=5 |
| 41 |
select * from t2; |
| 42 |
f1 f2 |
| 43 |
1 2 |
| 44 |
insert into t2 values(2, 3); |
| 45 |
ERROR HY000: Running in read-only mode |
| 46 |
alter table t2 add f3 int not null, algorithm=copy; |
| 47 |
ERROR HY000: Can't create table `test`.`t2` (errno: 165 "Table is read only") |
| 48 |
alter table t2 add f3 int not null, algorithm=inplace; |
| 49 |
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Running in read-only mode. Try ALGORITHM=COPY |
| 50 |
drop index idx on t2; |
| 51 |
ERROR HY000: Can't create table `test`.`t2` (errno: 165 "Table is read only") |
| 52 |
update t2 set f1=3 where f2=2; |
| 53 |
ERROR HY000: Running in read-only mode |
| 54 |
create table t3(f1 int not null)engine=innodb; |
| 55 |
ERROR HY000: Can't create table `test`.`t3` (errno: 165 "Table is read only") |
| 56 |
drop table t3; |
| 57 |
ERROR HY000: Table 't3' is read only |
| 58 |
rename table t2 to t3; |
| 59 |
ERROR HY000: Error on rename of './test/t2' to './test/t3' (errno: 165 "Table is read only") |
| 60 |
truncate table t2; |
| 61 |
ERROR HY000: Table 't2' is read only |
| 62 |
drop table t2; |
| 63 |
ERROR HY000: Table 't2' is read only |
| 64 |
create schema db; |
| 65 |
drop schema db; |
| 66 |
show tables; |
| 67 |
Tables_in_test |
| 68 |
t1 |
| 69 |
t2 |
| 70 |
# restart: --innodb-force-recovery=6 |
| 71 |
select * from t2; |
| 72 |
f1 f2 |
| 73 |
1 2 |
| 74 |
insert into t2 values(2, 3); |
| 75 |
ERROR HY000: Table 't2' is read only |
| 76 |
alter table t2 add f3 int not null, algorithm=copy; |
| 77 |
ERROR HY000: Table 't2' is read only |
| 78 |
alter table t2 add f3 int not null, algorithm=inplace; |
| 79 |
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Running in read-only mode. Try ALGORITHM=COPY |
| 80 |
drop index idx on t2; |
| 81 |
ERROR HY000: Table 't2' is read only |
| 82 |
update t2 set f1=3 where f2=2; |
| 83 |
ERROR HY000: Table 't2' is read only |
| 84 |
create table t3(f1 int not null)engine=innodb; |
| 85 |
ERROR HY000: Can't create table `test`.`t3` (errno: 165 "Table is read only") |
| 86 |
drop table t1; |
| 87 |
ERROR HY000: Table 't1' is read only |
| 88 |
rename table t2 to t3; |
| 89 |
ERROR HY000: Error on rename of './test/t2' to './test/t3' (errno: 165 "Table is read only") |
| 90 |
truncate table t2; |
| 91 |
ERROR HY000: Table 't2' is read only |
| 92 |
drop table t2; |
| 93 |
ERROR HY000: Table 't2' is read only |
| 94 |
show tables; |
| 95 |
Tables_in_test |
| 96 |
t1 |
| 97 |
t2 |
| 98 |
# restart: --innodb-force-recovery=2 |
| 99 |
select * from t2; |
| 100 |
f1 f2 |
| 101 |
1 2 |
| 102 |
begin; |
| 103 |
update t2 set f2=3; |
| 104 |
connect con1,localhost,root,,; |
| 105 |
# Force a redo log flush of the above uncommitted UPDATE |
| 106 |
SET GLOBAL innodb_flush_log_at_trx_commit=1; |
| 107 |
drop table t1; |
| 108 |
disconnect con1; |
| 109 |
connection default; |
| 110 |
# Kill the server |
| 111 |
# restart: --innodb-force-recovery=3 |
| 112 |
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; |
| 113 |
select * from t2; |
| 114 |
f1 f2 |
| 115 |
1 3 |
| 116 |
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; |
| 117 |
select * from t2; |
| 118 |
f1 f2 |
| 119 |
1 2 |
| 120 |
SET SESSION innodb_lock_wait_timeout=1; |
| 121 |
insert into t2 values(1,2); |
| 122 |
ERROR HY000: Lock wait timeout exceeded; try restarting transaction |
| 123 |
insert into t2 values(9,10); |
| 124 |
# restart |
| 125 |
select * from t2; |
| 126 |
f1 f2 |
| 127 |
1 2 |
| 128 |
9 10 |
| 129 |
drop table t2; |
| 130 |
show tables; |
| 131 |
Tables_in_test |