Debian Codegraph @

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

raw
1
2 # This test case needs InnoDB.
3
4 call mtr.add_suppression("Unable to use user mysql.session account when connecting the server for internal plugin requests");
5 call mtr.add_suppression("Failed to find tablespace for table .* in the cache. Attempting to load the tablespace with space id");
6
7 --disable_query_log
8 --source include/add_mtr_suppression_for_innodb_readonly.inc
9 --enable_query_log
10
11 create table t1(f1 int not null, f2 int not null, index idx(f2))engine=innodb;
12 create table t2(f1 int not null, f2 int not null, index idx(f2))engine=innodb;
13 insert into t1 values(1, 2);
14 insert into t2 values(1, 2);
15
16 SET GLOBAL innodb_fast_shutdown = 0;
17
18 let $restart_parameters = restart: --innodb-force-recovery=4;
19 --source include/restart_mysqld.inc
20
21 select * from t1;
22
23 --error ER_OPEN_AS_READONLY
24 insert into t1 values(2, 3);
25
26 --error ER_INNODB_READ_ONLY
27 alter table t1 add f3 int not null, algorithm=copy;
28
29 --error ER_INNODB_FORCED_RECOVERY
30 alter table t1 add f3 int not null, algorithm=inplace;
31
32 --error ER_INNODB_FORCED_RECOVERY
33 drop index idx on t1;
34
35 --error ER_OPEN_AS_READONLY
36 update t1 set f1=3 where f2=2;
37
38 --error ER_READ_ONLY_MODE
39 create table t3(f1 int not null)engine=innodb;
40
41 --error ER_BAD_TABLE_ERROR
42 drop table t3;
43
44 --error ER_ERROR_ON_RENAME
45 rename table t1 to t3;
46
47 --error ER_OPEN_AS_READONLY
48 truncate table t1;
49
50 --error ER_READ_ONLY_MODE
51 create tablespace t4 add datafile 't1.ibd' Engine=InnoDB;
52
53 let $restart_parameters =;
54 --source include/restart_mysqld.inc
55
56 drop table t1;
57 show tables;
58
59 --echo # Restart the server with innodb_force_recovery as 5.
60 let $restart_parameters = restart: --innodb-force-recovery=5;
61 --source include/restart_mysqld.inc
62
63 select * from t2;
64
65 --error ER_OPEN_AS_READONLY
66 insert into t2 values(2, 3);
67
68 --error ER_INNODB_READ_ONLY
69 alter table t2 add f3 int not null, algorithm=copy;
70
71 --error ER_INNODB_FORCED_RECOVERY
72 alter table t2 add f3 int not null, algorithm=inplace;
73
74 --error ER_INNODB_FORCED_RECOVERY
75 drop index idx on t2;
76
77 --error ER_OPEN_AS_READONLY
78 update t2 set f1=3 where f2=2;
79
80 --error ER_READ_ONLY_MODE
81 create table t1(f1 int not null)engine=innodb;
82
83 --error ER_BAD_TABLE_ERROR
84 drop table t1;
85
86 --error ER_ERROR_ON_RENAME
87 rename table t2 to t3;
88
89 --error ER_OPEN_AS_READONLY
90 truncate table t2;
91
92 --error ER_READ_ONLY_MODE
93 create tablespace t1 add datafile 't1.ibd' Engine=InnoDB;
94
95 --error ER_ENGINE_CANT_DROP_TABLE
96 drop table t2;
97 show tables;
98
99 --echo # Restart the server with innodb_force_recovery as 6.
100 let $restart_parameters = restart: --innodb-force-recovery=6;
101 --source include/restart_mysqld.inc
102
103 select * from t2;
104
105 --error ER_CANT_LOCK
106 insert into t2 values(2, 3);
107
108 --error ER_INNODB_READ_ONLY
109 alter table t2 add f3 int not null, algorithm=copy;
110
111 --error ER_INNODB_FORCED_RECOVERY
112 alter table t2 add f3 int not null, algorithm=inplace;
113
114 --error ER_INNODB_FORCED_RECOVERY
115 drop index idx on t2;
116
117 --error ER_CANT_LOCK
118 update t2 set f1=3 where f2=2;
119
120 --error ER_READ_ONLY_MODE
121 create table t1(f1 int not null)engine=innodb;
122
123 --error ER_BAD_TABLE_ERROR
124 drop table t1;
125
126 --error ER_ERROR_ON_RENAME
127 rename table t2 to t3;
128
129 --error ER_OPEN_AS_READONLY
130 truncate table t2;
131
132 --error ER_READ_ONLY_MODE
133 create tablespace t1 add datafile 't1.ibd' Engine=InnoDB;
134
135 --error ER_ENGINE_CANT_DROP_TABLE
136 drop table t2;
137 show tables;
138
139 let $restart_parameters = restart;
140 --source include/restart_mysqld.inc
141
142 drop table t2;
143 show tables;
144