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; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index ef3f9617069..a511a3d175e 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -13118,8 +13118,7 @@ inline int ha_innobase::delete_table(const char* name, enum_sql_command sqlcom) extension, in contrast to ::create */ normalize_table_name(norm_name, name); - if (srv_read_only_mode - || srv_force_recovery >= SRV_FORCE_NO_UNDO_LOG_SCAN) { + if (high_level_read_only) { DBUG_RETURN(HA_ERR_TABLE_READONLY); } @@ -13308,7 +13307,7 @@ innobase_drop_database( DBUG_ASSERT(hton == innodb_hton_ptr); - if (srv_read_only_mode) { + if (high_level_read_only) { return; }