Commit 67e9c4cf authored by Marko Mäkelä's avatar Marko Mäkelä

Adapt the test case for Oracle Bug#25385590

buf_chunk_not_freed(), logs_empty_and_mark_files_at_shutdown():
Relax debug assertions when innodb_force_recovery=6
implies innodb_read_only.
parent 7223ec4c
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;
# Restart the server with innodb_force_recovery as 4.
select * from t1;
f1 f2
1 2
insert into t1 values(2, 3);
ERROR HY000: Running in read-only mode
alter table t1 add f3 int not null, algorithm=copy;
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 165 "Table is read only")
alter table t1 add f3 int not null, algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Operation not allowed when innodb_forced_recovery > 0.. Try ALGORITHM=COPY
drop index idx on t1;
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 165 "Table is read only")
alter table t1 drop index idx, algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Operation not allowed when innodb_forced_recovery > 0.. Try ALGORITHM=COPY
update t1 set f1=3 where f2=2;
ERROR HY000: Running in read-only mode
create table t3(f1 int not null)engine=innodb;
ERROR HY000: Can't create table `test`.`t3` (errno: 165 "Table is read only")
drop table t3;
ERROR 42S02: Unknown table 'test.t3'
rename table t1 to t3;
ERROR HY000: Error on rename of './test/t1' to './test/t3' (errno: 165 "Table is read only")
truncate table t1;
ERROR HY000: Table 't1' is read only
drop table t1;
show tables;
Tables_in_test
t2
# Restart the server with innodb_force_recovery as 5.
select * from t2;
f1 f2
1 2
insert into t2 values(2, 3);
ERROR HY000: Running in read-only mode
alter table t2 add f3 int not null, algorithm=copy;
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 165 "Table is read only")
alter table t2 add f3 int not null, algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Operation not allowed when innodb_forced_recovery > 0.. Try ALGORITHM=COPY
drop index idx on t2;
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 165 "Table is read only")
update t2 set f1=3 where f2=2;
ERROR HY000: Running in read-only mode
create table t1(f1 int not null)engine=innodb;
ERROR HY000: Can't create table `test`.`t1` (errno: 165 "Table is read only")
drop table t1;
ERROR 42S02: Unknown table 'test.t1'
rename table t2 to t3;
ERROR HY000: Error on rename of './test/t2' to './test/t3' (errno: 165 "Table is read only")
truncate table t2;
ERROR HY000: Table 't2' is read only
drop table t2;
ERROR HY000: Table 't2' is read only
show tables;
Tables_in_test
t2
# Restart the server with innodb_force_recovery as 6.
select * from t2;
f1 f2
1 2
insert into t2 values(2, 3);
ERROR HY000: Table 't2' is read only
alter table t2 add f3 int not null, algorithm=copy;
ERROR HY000: Table 't2' is read only
alter table t2 add f3 int not null, algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Operation not allowed when innodb_forced_recovery > 0.. Try ALGORITHM=COPY
drop index idx on t2;
ERROR HY000: Table 't2' is read only
update t2 set f1=3 where f2=2;
ERROR HY000: Table 't2' is read only
create table t1(f1 int not null)engine=innodb;
ERROR HY000: Can't create table `test`.`t1` (errno: 165 "Table is read only")
drop table t1;
ERROR 42S02: Unknown table 'test.t1'
rename table t2 to t3;
ERROR HY000: Error on rename of './test/t2' to './test/t3' (errno: 165 "Table is read only")
truncate table t2;
ERROR HY000: Table 't2' is read only
drop table t2;
ERROR HY000: Table 't2' is read only
show tables;
Tables_in_test
t2
drop table t2;
show tables;
Tables_in_test
# Not supported in embedded
--source include/not_embedded.inc
# This test case needs InnoDB.
-- source include/have_innodb.inc
--disable_query_log
call mtr.add_suppression("InnoDB: Failed to find tablespace for table .* in the cache. Attempting to load the tablespace with space id");
call mtr.add_suppression("InnoDB: Allocated tablespace ID \\d+ for test.t[12], old maximum was");
--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;
--echo # Restart the server with innodb_force_recovery as 4.
--let $restart_parameters= --innodb-force-recovery=4
--source include/restart_mysqld.inc
select * from t1;
--error ER_READ_ONLY_MODE
insert into t1 values(2, 3);
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CANT_CREATE_TABLE
alter table t1 add f3 int not null, algorithm=copy;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table t1 add f3 int not null, algorithm=inplace;
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CANT_CREATE_TABLE
drop index idx on t1;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table t1 drop index idx, algorithm=inplace;
--error ER_READ_ONLY_MODE
update t1 set f1=3 where f2=2;
--error ER_CANT_CREATE_TABLE
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;
drop table t1;
show tables;
--echo # Restart the server with innodb_force_recovery as 5.
--let $restart_parameters= --innodb-force-recovery=5
--source include/restart_mysqld.inc
select * from t2;
--error ER_READ_ONLY_MODE
insert into t2 values(2, 3);
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CANT_CREATE_TABLE
alter table t2 add f3 int not null, algorithm=copy;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table t2 add f3 int not null, algorithm=inplace;
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CANT_CREATE_TABLE
drop index idx on t2;
--error ER_READ_ONLY_MODE
update t2 set f1=3 where f2=2;
--error ER_CANT_CREATE_TABLE
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_OPEN_AS_READONLY
drop table t2;
show tables;
--echo # Restart the server with innodb_force_recovery as 6.
--let $restart_parameters= --innodb-force-recovery=6
--source include/restart_mysqld.inc
select * from t2;
--error ER_OPEN_AS_READONLY
insert into t2 values(2, 3);
--error ER_OPEN_AS_READONLY
alter table t2 add f3 int not null, algorithm=copy;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table t2 add f3 int not null, algorithm=inplace;
--error ER_OPEN_AS_READONLY
drop index idx on t2;
--error ER_OPEN_AS_READONLY
update t2 set f1=3 where f2=2;
--error ER_CANT_CREATE_TABLE
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_OPEN_AS_READONLY
drop table t2;
show tables;
--let $restart_parameters=
--source include/restart_mysqld.inc
drop table t2;
show tables;
......@@ -1762,7 +1762,9 @@ buf_chunk_not_freed(
== block->page.newest_modification);
ut_ad(block->page.oldest_modification == 0
|| block->page.oldest_modification
== recv_sys->recovered_lsn);
== recv_sys->recovered_lsn
|| srv_force_recovery
== SRV_FORCE_NO_LOG_REDO);
ut_ad(block->page.buf_fix_count == 0);
ut_ad(block->page.io_fix == BUF_IO_NONE);
break;
......
......@@ -2172,7 +2172,8 @@ logs_empty_and_mark_files_at_shutdown(void)
bool freed = buf_all_freed();
ut_a(freed);
ut_a(lsn == log_sys->lsn);
ut_a(lsn == log_sys->lsn
|| srv_force_recovery == SRV_FORCE_NO_LOG_REDO);
if (lsn < srv_start_lsn) {
ib::error() << "Shutdown LSN=" << lsn
......@@ -2198,7 +2199,8 @@ logs_empty_and_mark_files_at_shutdown(void)
freed = buf_all_freed();
ut_a(freed);
ut_a(lsn == log_sys->lsn);
ut_a(lsn == log_sys->lsn
|| srv_force_recovery == SRV_FORCE_NO_LOG_REDO);
}
/******************************************************//**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment