summaryrefslogtreecommitdiff
path: root/mysql-test/t/myisam.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/myisam.test')
-rw-r--r--mysql-test/t/myisam.test36
1 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index e912eb754f4..cab06a03498 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -507,6 +507,7 @@ insert into t2 values(2,0);
disconnect root;
connection default;
select straight_join * from t1,t2 force index (primary) where t1.a=t2.a;
+unlock tables;
drop table t1,t2;
#
# Full key.
@@ -524,6 +525,7 @@ disconnect con1;
connection default;
SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2
WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1;
+UNLOCK TABLES;
DROP TABLE t1,t2;
# End of 4.0 tests
@@ -1694,5 +1696,39 @@ SET myisam_repair_threads=@@global.myisam_repair_threads;
--echo End of 5.1 tests
+--echo #
+--echo # Bug#51327 MyISAM table is automatically repaired on ALTER
+--echo # even if myisam-recover is OFF
+--echo #
+
+call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:");
+call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
+call mtr.add_suppression(" '\..test.t1'");
+
+let $MYSQLD_DATADIR = `SELECT @@datadir`;
+--echo # Test that we can exchange a crashed partition with a table
+SELECT @@global.myisam_recover_options;
+CREATE TABLE t1 (a INT, KEY (a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1), (2);
+FLUSH TABLES;
+
+--echo # replacing t.MYI with a corrupt + unclosed one created by doing:
+--echo # 'create table t1 (a int key(a))' head -c1024 t1.MYI > corrupt_t1.MYI
+--remove_file $MYSQLD_DATADIR/test/t1.MYI
+--copy_file std_data/corrupt_t1.MYI $MYSQLD_DATADIR/test/t1.MYI
+
+CHECK TABLE t1;
+--echo # Alter table should report error and not auto-repair the table.
+# Remove the path to t1 to prevent platform differences
+--replace_regex /'[^']+'/'t1'/
+--error 145
+ALTER TABLE t1 ENGINE = MyISAM;
+CHECK TABLE t1;
+
+DROP TABLE t1;
+
+#
+# Check some variables
+#
show variables like 'myisam_block_size';
select @@global.myisam_block_size;