diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/mysqlcheck.result | 90 | ||||
-rw-r--r-- | mysql-test/std_data/bug47205.frm | bin | 0 -> 8554 bytes | |||
-rw-r--r-- | mysql-test/t/mysqlcheck.test | 108 |
3 files changed, 172 insertions, 26 deletions
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index ef46eba5ccb..42fb1945d8b 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -109,7 +109,7 @@ mysql.time_zone_name Table is already up to date mysql.time_zone_transition Table is already up to date mysql.time_zone_transition_type Table is already up to date mysql.user Table is already up to date -create table t1 (a int); +create table t1 (a int) engine=myisam; create view v1 as select * from t1; test.t1 OK test.t1 Table is already up to date @@ -117,14 +117,14 @@ test.t1 OK test.t1 Table is already up to date drop view v1; drop table t1; -create table `t``1`(a int); -create table `t 1`(a int); +create table `t``1`(a int) engine=myisam; +create table `t 1`(a int) engine=myisam; test.t 1 OK test.t`1 OK drop table `t``1`, `t 1`; create database d_bug25347; use d_bug25347; -create table t_bug25347 (a int); +create table t_bug25347 (a int) engine=myisam; create view v_bug25347 as select * from t_bug25347; insert into t_bug25347 values (1),(2),(3); flush tables; @@ -164,15 +164,15 @@ Table Op Msg_type Msg_text test.v1 check status OK information_schema.routines check note The storage engine for the table doesn't support check drop view v1; -CREATE TABLE t1(a INT); -CREATE TABLE t2(a INT); +CREATE TABLE t1(a INT) engine=myisam; +CREATE TABLE t2(a INT) engine=myisam; test.t1 Error : Incorrect information in file: './test/t1.frm' error : Corrupt test.t2 OK DROP TABLE t1, t2; End of 5.0 tests -create table t1(a int); +create table t1(a int) engine=myisam; create view v1 as select * from t1; show tables; Tables_in_test @@ -192,7 +192,7 @@ v-1 drop view v1, `v-1`; drop table t1; SET NAMES utf8; -CREATE TABLE `#mysql50#@` (a INT); +CREATE TABLE `#mysql50#@` (a INT) engine=myisam; SHOW TABLES; Tables_in_test #mysql50#@ @@ -203,7 +203,7 @@ SHOW TABLES; Tables_in_test @ DROP TABLE `@`; -CREATE TABLE `я` (a INT); +CREATE TABLE `я` (a INT) engine=myisam; SET NAMES DEFAULT; mysqlcheck --default-character-set="latin1" --databases test test.? @@ -216,8 +216,8 @@ DROP TABLE `я`; SET NAMES DEFAULT; CREATE DATABASE `#mysql50#a@b`; USE `#mysql50#a@b`; -CREATE TABLE `#mysql50#c@d` (a INT); -CREATE TABLE t1 (a INT); +CREATE TABLE `#mysql50#c@d` (a INT) engine=myisam; +CREATE TABLE t1 (a INT) engine=myisam; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_SCHEMA="#mysql50#a@b" ORDER BY trigger_name; TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -246,12 +246,12 @@ USE test; # Bug #31821: --all-in-1 and --fix-table-names don't work together # drop table if exists `#mysql50#t1-1`; -create table `#mysql50#t1-1` (a int); +create table `#mysql50#t1-1` (a int) engine=myisam; show tables like 't1-1'; Tables_in_test (t1-1) t1-1 drop table `t1-1`; -create table `#mysql50#t1-1` (a int); +create table `#mysql50#t1-1` (a int) engine=myisam; show tables like 't1-1'; Tables_in_test (t1-1) t1-1 @@ -260,3 +260,67 @@ End of 5.1 tests # # Bug #35269: mysqlcheck behaves different depending on order of parameters # +# +# Bug#11755431 47205: MAP 'REPAIR TABLE' TO RECREATE +ANALYZE FOR +# ENGINES NOT SUPPORTING NATIVE +# +DROP TABLE IF EXISTS bug47205; +# +# Test 1: Check that ALTER TABLE ... rebuilds the table +CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY) +DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb; +INSERT INTO bug47205 VALUES ("foobar"); +FLUSH TABLE bug47205; +# Replace the FRM with a 5.0 FRM that will require upgrade +# Should indicate that ALTER TABLE ... FORCE is needed +CHECK TABLE bug47205 FOR UPGRADE; +Table Op Msg_type Msg_text +test.bug47205 check error Table rebuild required. Please do "ALTER TABLE `bug47205` FORCE" or dump/reload to fix it! +# ALTER TABLE ... FORCE should rebuild the table +# and therefore output "affected rows: 1" +ALTER TABLE bug47205 FORCE; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Table should now be ok +CHECK TABLE bug47205 FOR UPGRADE; +Table Op Msg_type Msg_text +test.bug47205 check status OK +DROP TABLE bug47205; +# +# Test 2: InnoDB - REPAIR not supported +CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY) +DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb; +FLUSH TABLE bug47205; +# Replace the FRM with a 5.0 FRM that will require upgrade +# Should indicate that ALTER TABLE .. FORCE is needed +CHECK TABLE bug47205 FOR UPGRADE; +Table Op Msg_type Msg_text +test.bug47205 check error Table rebuild required. Please do "ALTER TABLE `bug47205` FORCE" or dump/reload to fix it! +# Running mysqlcheck to check and upgrade +test.bug47205 +error : Table rebuild required. Please do "ALTER TABLE `bug47205` FORCE" or dump/reload to fix it! + +Repairing tables +# Table should now be ok +CHECK TABLE bug47205 FOR UPGRADE; +Table Op Msg_type Msg_text +test.bug47205 check status OK +DROP TABLE bug47205; +# +# Test 3: MyISAM - REPAIR supported +# Use an old FRM that will require upgrade +# Should indicate that REPAIR TABLE is needed +CHECK TABLE bug47205 FOR UPGRADE; +Table Op Msg_type Msg_text +test.bug47205 check error Table upgrade required. Please do "REPAIR TABLE `bug47205`" or dump/reload to fix it! +# Running mysqlcheck to check and upgrade +test.bug47205 +error : Table upgrade required. Please do "REPAIR TABLE `bug47205`" or dump/reload to fix it! + +Repairing tables +test.bug47205 OK +# Table should now be ok +CHECK TABLE bug47205 FOR UPGRADE; +Table Op Msg_type Msg_text +test.bug47205 check status OK +DROP TABLE bug47205; diff --git a/mysql-test/std_data/bug47205.frm b/mysql-test/std_data/bug47205.frm Binary files differnew file mode 100644 index 00000000000..6d53b221d28 --- /dev/null +++ b/mysql-test/std_data/bug47205.frm diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test index dd113cb4e74..8f93ac7b864 100644 --- a/mysql-test/t/mysqlcheck.test +++ b/mysql-test/t/mysqlcheck.test @@ -2,6 +2,8 @@ # Embedded server doesn't support external clients --source include/not_embedded.inc +--source include/have_innodb.inc + # check that CSV engine was compiled in, as the result of the test # depends on the presence of the log tables (which are CSV-based). --source include/have_csv.inc @@ -34,7 +36,7 @@ drop database if exists client_test_db; # # Bug #16502: mysqlcheck tries to check views # -create table t1 (a int); +create table t1 (a int) engine=myisam; create view v1 as select * from t1; --replace_result 'Table is already up to date' OK --exec $MYSQL_CHECK --analyze --databases test @@ -48,8 +50,8 @@ drop table t1; # # Bug #30654: mysqlcheck fails during upgrade of tables whose names include backticks # -create table `t``1`(a int); -create table `t 1`(a int); +create table `t``1`(a int) engine=myisam; +create table `t 1`(a int) engine=myisam; --replace_result 'Table is already up to date' OK --exec $MYSQL_CHECK --databases test drop table `t``1`, `t 1`; @@ -59,7 +61,7 @@ drop table `t``1`, `t 1`; # create database d_bug25347; use d_bug25347; -create table t_bug25347 (a int); +create table t_bug25347 (a int) engine=myisam; create view v_bug25347 as select * from t_bug25347; insert into t_bug25347 values (1),(2),(3); flush tables; @@ -91,8 +93,8 @@ drop view v1; # Bug#37527: mysqlcheck fails to report entire database # when frm file corruption # -CREATE TABLE t1(a INT); -CREATE TABLE t2(a INT); +CREATE TABLE t1(a INT) engine=myisam; +CREATE TABLE t2(a INT) engine=myisam; # backup then null t1.frm --copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/t1.frm.bak --remove_file $MYSQLD_DATADIR/test/t1.frm @@ -112,7 +114,7 @@ DROP TABLE t1, t2; # # Bug #30679: 5.1 name encoding not performed for views during upgrade # -create table t1(a int); +create table t1(a int) engine=myisam; create view v1 as select * from t1; show tables; let $MYSQLD_DATADIR= `select @@datadir`; @@ -131,7 +133,7 @@ drop table t1; # triggers # SET NAMES utf8; -CREATE TABLE `#mysql50#@` (a INT); +CREATE TABLE `#mysql50#@` (a INT) engine=myisam; SHOW TABLES; SET NAMES DEFAULT; --echo mysqlcheck --fix-table-names --databases test @@ -140,7 +142,7 @@ SET NAMES utf8; SHOW TABLES; DROP TABLE `@`; -CREATE TABLE `я` (a INT); +CREATE TABLE `я` (a INT) engine=myisam; SET NAMES DEFAULT; --echo mysqlcheck --default-character-set="latin1" --databases test # Error returned depends on platform, replace it with "Table doesn't exist" @@ -154,8 +156,8 @@ SET NAMES DEFAULT; CREATE DATABASE `#mysql50#a@b`; USE `#mysql50#a@b`; -CREATE TABLE `#mysql50#c@d` (a INT); -CREATE TABLE t1 (a INT); +CREATE TABLE `#mysql50#c@d` (a INT) engine=myisam; +CREATE TABLE t1 (a INT) engine=myisam; # Create 5.0 like triggers let $MYSQLTEST_VARDIR= `select @@datadir`; @@ -207,12 +209,12 @@ USE test; drop table if exists `#mysql50#t1-1`; --enable_warnings -create table `#mysql50#t1-1` (a int); +create table `#mysql50#t1-1` (a int) engine=myisam; --exec $MYSQL_CHECK --all-in-1 --fix-table-names --databases test show tables like 't1-1'; drop table `t1-1`; -create table `#mysql50#t1-1` (a int); +create table `#mysql50#t1-1` (a int) engine=myisam; --exec $MYSQL_CHECK --all-in-1 --fix-table-names test "#mysql50#t1-1" show tables like 't1-1'; drop table `t1-1`; @@ -229,3 +231,83 @@ drop table `t1-1`; --error 1 --exec $MYSQL_CHECK -aoc test "#mysql50#t1-1" + +--echo # +--echo # Bug#11755431 47205: MAP 'REPAIR TABLE' TO RECREATE +ANALYZE FOR +--echo # ENGINES NOT SUPPORTING NATIVE +--echo # + +--disable_warnings +DROP TABLE IF EXISTS bug47205; +--enable_warnings + +--echo # +--echo # Test 1: Check that ALTER TABLE ... rebuilds the table + +CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY) + DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb; + +INSERT INTO bug47205 VALUES ("foobar"); +FLUSH TABLE bug47205; + +--echo # Replace the FRM with a 5.0 FRM that will require upgrade +let $MYSQLD_DATADIR= `select @@datadir`; +--remove_file $MYSQLD_DATADIR/test/bug47205.frm +--copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/bug47205.frm + +--echo # Should indicate that ALTER TABLE ... FORCE is needed +CHECK TABLE bug47205 FOR UPGRADE; + +--echo # ALTER TABLE ... FORCE should rebuild the table +--echo # and therefore output "affected rows: 1" +--enable_info +ALTER TABLE bug47205 FORCE; +--disable_info + +--echo # Table should now be ok +CHECK TABLE bug47205 FOR UPGRADE; + +DROP TABLE bug47205; + +--echo # +--echo # Test 2: InnoDB - REPAIR not supported + +CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY) + DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb; + +FLUSH TABLE bug47205; + +--echo # Replace the FRM with a 5.0 FRM that will require upgrade +let $MYSQLD_DATADIR= `select @@datadir`; +--remove_file $MYSQLD_DATADIR/test/bug47205.frm +--copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/bug47205.frm + +--echo # Should indicate that ALTER TABLE .. FORCE is needed +CHECK TABLE bug47205 FOR UPGRADE; + +--echo # Running mysqlcheck to check and upgrade +--exec $MYSQL_CHECK --check-upgrade --auto-repair test + +--echo # Table should now be ok +CHECK TABLE bug47205 FOR UPGRADE; + +DROP TABLE bug47205; + +--echo # +--echo # Test 3: MyISAM - REPAIR supported + +--echo # Use an old FRM that will require upgrade +--copy_file std_data/bug36055.frm $MYSQLD_DATADIR/test/bug47205.frm +--copy_file std_data/bug36055.MYD $MYSQLD_DATADIR/test/bug47205.MYD +--copy_file std_data/bug36055.MYI $MYSQLD_DATADIR/test/bug47205.MYI + +--echo # Should indicate that REPAIR TABLE is needed +CHECK TABLE bug47205 FOR UPGRADE; + +--echo # Running mysqlcheck to check and upgrade +--exec $MYSQL_CHECK --check-upgrade --auto-repair test + +--echo # Table should now be ok +CHECK TABLE bug47205 FOR UPGRADE; + +DROP TABLE bug47205; |