Debian Codegraph @

mysql-test/suite/innodb/t/innodb_force_recovery.test

raw
1 # Not supported in embedded
2 --source include/not_embedded.inc
3
4 # This test case needs InnoDB.
5 -- source include/have_innodb.inc
6
7 --disable_query_log
8 call mtr.add_suppression("InnoDB: Failed to find tablespace for table .* in the cache. Attempting to load the tablespace with space id");
9 call mtr.add_suppression("InnoDB: Allocated tablespace ID \\d+ for test.t[12], old maximum was");
10 call mtr.add_suppression("InnoDB: Allocated tablespace ID \\d+ for mysql.transaction_registry, old maximum was");
11 --enable_query_log
12
13 create table t1(f1 int not null, f2 int not null, index idx(f2))engine=innodb;
14 create table t2(f1 int primary key, f2 int, index idx(f2))engine=innodb;
15 insert into t1 values(1, 2);
16 insert into t2 values(1, 2);
17
18 SET GLOBAL innodb_fast_shutdown = 0;
19
20 --let $restart_parameters= --innodb-force-recovery=4
21 --source include/restart_mysqld.inc
22 let $status=`SHOW ENGINE INNODB STATUS`;
23
24 select variable_name,variable_value from information_schema.global_status
25 WHERE variable_name LIKE 'innodb_buffer_pool_%_requests';
26 select * from t1;
27 select variable_name from information_schema.global_status
28 WHERE variable_name LIKE 'innodb_buffer_pool_%_requests' and variable_value>0;
29
30 begin;
31 insert into t1 values(2, 3);
32 rollback;
33 select variable_name from information_schema.global_status
34 WHERE variable_name LIKE 'innodb_buffer_pool_%_requests' and variable_value>0;
35
36 alter table t1 add f3 int not null, algorithm=copy;
37
38 alter table t1 add f4 int not null, algorithm=inplace;
39
40 drop index idx on t1;
41
42 update t1 set f1=3 where f2=2;
43
44 create table t3(f1 int not null)engine=innodb;
45 drop table t3;
46
47 rename table t1 to t3;
48 rename table t3 to t1;
49 truncate table t1;
50
51 show tables;
52
53 --let $restart_parameters= --innodb-force-recovery=5
54 --source include/restart_mysqld.inc
55 let $status=`SHOW ENGINE INNODB STATUS`;
56
57 select * from t2;
58
59 --error ER_READ_ONLY_MODE
60 insert into t2 values(2, 3);
61
62 --error ER_CANT_CREATE_TABLE
63 alter table t2 add f3 int not null, algorithm=copy;
64
65 --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
66 alter table t2 add f3 int not null, algorithm=inplace;
67
68 --error ER_CANT_CREATE_TABLE
69 drop index idx on t2;
70
71 --error ER_READ_ONLY_MODE
72 update t2 set f1=3 where f2=2;
73
74 --error ER_CANT_CREATE_TABLE
75 create table t3(f1 int not null)engine=innodb;
76
77 --error ER_OPEN_AS_READONLY
78 drop table t3;
79
80 --error ER_ERROR_ON_RENAME
81 rename table t2 to t3;
82
83 --error ER_OPEN_AS_READONLY
84 truncate table t2;
85
86 --error ER_OPEN_AS_READONLY
87 drop table t2;
88
89 create schema db;
90 drop schema db;
91 show tables;
92
93 --let $restart_parameters= --innodb-force-recovery=6
94 --source include/restart_mysqld.inc
95 let $status=`SHOW ENGINE INNODB STATUS`;
96
97 select * from t2;
98
99 --error ER_OPEN_AS_READONLY
100 insert into t2 values(2, 3);
101
102 --error ER_OPEN_AS_READONLY
103 alter table t2 add f3 int not null, algorithm=copy;
104
105 --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
106 alter table t2 add f3 int not null, algorithm=inplace;
107
108 --error ER_OPEN_AS_READONLY
109 drop index idx on t2;
110
111 --error ER_OPEN_AS_READONLY
112 update t2 set f1=3 where f2=2;
113
114 --error ER_CANT_CREATE_TABLE
115 create table t3(f1 int not null)engine=innodb;
116
117 --error ER_OPEN_AS_READONLY
118 drop table t1;
119
120 --error ER_ERROR_ON_RENAME
121 rename table t2 to t3;
122
123 --error ER_OPEN_AS_READONLY
124 truncate table t2;
125
126 --error ER_OPEN_AS_READONLY
127 drop table t2;
128 show tables;
129
130 --let $restart_parameters= --innodb-force-recovery=2
131 --source include/restart_mysqld.inc
132 let $status=`SHOW ENGINE INNODB STATUS`;
133
134 select * from t2;
135 begin;
136 update t2 set f2=3;
137
138 connect (con1,localhost,root,,);
139 --echo # Force a redo log flush of the above uncommitted UPDATE
140 SET GLOBAL innodb_flush_log_at_trx_commit=1;
141 drop table t1;
142 disconnect con1;
143
144 connection default;
145 --source include/kill_mysqld.inc
146
147 --let $restart_parameters= --innodb-force-recovery=3
148 --source include/start_mysqld.inc
149 let $status=`SHOW ENGINE INNODB STATUS`;
150
151 SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
152 --disable_ps2_protocol
153 select * from t2;
154 --enable_ps2_protocol
155 SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
156 select * from t2;
157 SET SESSION innodb_lock_wait_timeout=1;
158 --error ER_LOCK_WAIT_TIMEOUT
159 insert into t2 values(1,2);
160 insert into t2 values(9,10);
161
162 --let $restart_parameters=
163 --source include/restart_mysqld.inc
164
165 select * from t2;
166 drop table t2;
167 show tables;