summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-05-28 16:43:02 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-05-28 16:43:02 +0300
commit1ca75ae1c881bf0afae00f4acac0d668446a15d6 (patch)
tree1081ec3e9ae0c3776e3ebe2d01a8e2ce1a4a4795 /mysql-test
parent96d9f03328a737439dc81c5b85584db55449ca6b (diff)
downloadmariadb-git-1ca75ae1c881bf0afae00f4acac0d668446a15d6.tar.gz
MDEV-19587 innodb_force_recovery=5 crash on DROP SCHEMA
At higher levels of innodb_force_recovery, the InnoDB transaction subsystem will not be set up at all. At slightly lower levels, recovered transactions will not be rolled back, and DDL operations could hang due to locks being held at all. Let us consistently refuse all writes if the predicate high_level_read_only holds. We failed to refuse DROP TABLE and DROP DATABASE. (Refusing DROP TABLE is a partial backport from MDEV-19570 in the 10.5 branch.)
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/suite/innodb/r/innodb_force_recovery.result23
-rw-r--r--mysql-test/suite/innodb/t/innodb_force_recovery.test15
2 files changed, 23 insertions, 15 deletions
diff --git a/mysql-test/suite/innodb/r/innodb_force_recovery.result b/mysql-test/suite/innodb/r/innodb_force_recovery.result
index 0220f68a626..8e700f9489d 100644
--- a/mysql-test/suite/innodb/r/innodb_force_recovery.result
+++ b/mysql-test/suite/innodb/r/innodb_force_recovery.result
@@ -28,8 +28,10 @@ ERROR HY000: Error on rename of './test/t1' to './test/t3' (errno: 165 "Table is
truncate table t1;
ERROR HY000: Table 't1' is read only
drop table t1;
+ERROR HY000: Table 't1' is read only
show tables;
Tables_in_test
+t1
t2
# Restart the server with innodb_force_recovery as 5.
select * from t2;
@@ -45,18 +47,21 @@ drop index idx on t2;
ERROR HY000: Can't create table `test`.`t2` (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'
+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 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
+create schema db;
+drop schema db;
show tables;
Tables_in_test
+t1
t2
# Restart the server with innodb_force_recovery as 6.
select * from t2;
@@ -72,10 +77,10 @@ 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")
+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 t1;
-ERROR 42S02: Unknown table 'test.t1'
+ERROR HY000: Table 't1' is read only
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;
@@ -84,6 +89,7 @@ drop table t2;
ERROR HY000: Table 't2' is read only
show tables;
Tables_in_test
+t1
t2
# Restart the server with innodb_force_recovery=2
select * from t2;
@@ -92,10 +98,9 @@ f1 f2
begin;
update t2 set f2=3;
connect con1,localhost,root,,;
-create table t3(a int)engine=innodb;
# Force a redo log flush of the above uncommitted UPDATE
SET GLOBAL innodb_flush_log_at_trx_commit=1;
-drop table t3;
+drop table t1;
disconnect con1;
connection default;
# Kill the server
diff --git a/mysql-test/suite/innodb/t/innodb_force_recovery.test b/mysql-test/suite/innodb/t/innodb_force_recovery.test
index 822180dfbfa..b5b48281161 100644
--- a/mysql-test/suite/innodb/t/innodb_force_recovery.test
+++ b/mysql-test/suite/innodb/t/innodb_force_recovery.test
@@ -51,6 +51,7 @@ rename table t1 to t3;
--error ER_OPEN_AS_READONLY
truncate table t1;
+--error ER_OPEN_AS_READONLY
drop table t1;
show tables;
@@ -76,10 +77,10 @@ drop index idx on t2;
update t2 set f1=3 where f2=2;
--error ER_CANT_CREATE_TABLE
-create table t1(f1 int not null)engine=innodb;
+create table t3(f1 int not null)engine=innodb;
--error ER_BAD_TABLE_ERROR
-drop table t1;
+drop table t3;
--error ER_ERROR_ON_RENAME
rename table t2 to t3;
@@ -89,6 +90,9 @@ truncate table t2;
--error ER_OPEN_AS_READONLY
drop table t2;
+
+create schema db;
+drop schema db;
show tables;
--echo # Restart the server with innodb_force_recovery as 6.
@@ -113,9 +117,9 @@ drop index idx on t2;
update t2 set f1=3 where f2=2;
--error ER_CANT_CREATE_TABLE
-create table t1(f1 int not null)engine=innodb;
+create table t3(f1 int not null)engine=innodb;
---error ER_BAD_TABLE_ERROR
+--error ER_OPEN_AS_READONLY
drop table t1;
--error ER_ERROR_ON_RENAME
@@ -137,10 +141,9 @@ begin;
update t2 set f2=3;
connect (con1,localhost,root,,);
-create table t3(a int)engine=innodb;
--echo # Force a redo log flush of the above uncommitted UPDATE
SET GLOBAL innodb_flush_log_at_trx_commit=1;
-drop table t3;
+drop table t1;
disconnect con1;
connection default;