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

147 lines
3.5 KiB
Plaintext

# This test case needs InnoDB.
call mtr.add_suppression("Unable to use user mysql.session account when connecting the server for internal plugin requests");
call mtr.add_suppression("Failed to find tablespace for table .* in the cache. Attempting to load the tablespace with space id");
--disable_query_log
call mtr.add_suppression("Skip re-populating collations and character sets tables in InnoDB read-only mode.");
call mtr.add_suppression("Skip updating information_schema metadata in InnoDB read-only mode.");
call mtr.add_suppression("Skipped updating resource group metadata in InnoDB read only mode.");
--enable_query_log
create table t1(f1 int not null, f2 int not null, index idx(f2))engine=innodb;
create table t2(f1 int not null, f2 int not null, index idx(f2))engine=innodb;
insert into t1 values(1, 2);
insert into t2 values(1, 2);
SET GLOBAL innodb_fast_shutdown = 0;
let $restart_parameters = restart: --innodb-force-recovery=4;
--source include/restart_mysqld.inc
select * from t1;
--error ER_OPEN_AS_READONLY
insert into t1 values(2, 3);
--error ER_INNODB_READ_ONLY
alter table t1 add f3 int not null, algorithm=copy;
--error ER_INNODB_FORCED_RECOVERY
alter table t1 add f3 int not null, algorithm=inplace;
--error ER_INNODB_FORCED_RECOVERY
drop index idx on t1;
--error ER_OPEN_AS_READONLY
update t1 set f1=3 where f2=2;
--error ER_READ_ONLY_MODE
create table t3(f1 int not null)engine=innodb;
--error ER_BAD_TABLE_ERROR
drop table t3;
--error ER_ERROR_ON_RENAME
rename table t1 to t3;
--error ER_OPEN_AS_READONLY
truncate table t1;
--error ER_READ_ONLY_MODE
create tablespace t4 add datafile 't1.ibd' Engine=InnoDB;
let $restart_parameters =;
--source include/restart_mysqld.inc
drop table t1;
show tables;
--echo # Restart the server with innodb_force_recovery as 5.
let $restart_parameters = restart: --innodb-force-recovery=5;
--source include/restart_mysqld.inc
select * from t2;
--error ER_OPEN_AS_READONLY
insert into t2 values(2, 3);
--error ER_INNODB_READ_ONLY
alter table t2 add f3 int not null, algorithm=copy;
--error ER_INNODB_FORCED_RECOVERY
alter table t2 add f3 int not null, algorithm=inplace;
--error ER_INNODB_FORCED_RECOVERY
drop index idx on t2;
--error ER_OPEN_AS_READONLY
update t2 set f1=3 where f2=2;
--error ER_READ_ONLY_MODE
create table t1(f1 int not null)engine=innodb;
--error ER_BAD_TABLE_ERROR
drop table t1;
--error ER_ERROR_ON_RENAME
rename table t2 to t3;
--error ER_OPEN_AS_READONLY
truncate table t2;
--error ER_READ_ONLY_MODE
create tablespace t1 add datafile 't1.ibd' Engine=InnoDB;
--error ER_ENGINE_CANT_DROP_TABLE
drop table t2;
show tables;
--echo # Restart the server with innodb_force_recovery as 6.
let $restart_parameters = restart: --innodb-force-recovery=6;
--source include/restart_mysqld.inc
select * from t2;
--error ER_CANT_LOCK
insert into t2 values(2, 3);
--error ER_INNODB_READ_ONLY
alter table t2 add f3 int not null, algorithm=copy;
--error ER_INNODB_FORCED_RECOVERY
alter table t2 add f3 int not null, algorithm=inplace;
--error ER_INNODB_FORCED_RECOVERY
drop index idx on t2;
--error ER_CANT_LOCK
update t2 set f1=3 where f2=2;
--error ER_READ_ONLY_MODE
create table t1(f1 int not null)engine=innodb;
--error ER_BAD_TABLE_ERROR
drop table t1;
--error ER_ERROR_ON_RENAME
rename table t2 to t3;
--error ER_OPEN_AS_READONLY
truncate table t2;
--error ER_READ_ONLY_MODE
create tablespace t1 add datafile 't1.ibd' Engine=InnoDB;
--error ER_ENGINE_CANT_DROP_TABLE
drop table t2;
show tables;
let $restart_parameters = restart;
--source include/restart_mysqld.inc
drop table t2;
show tables;