diff options
author | Jon Olav Hauglid <jon.hauglid@sun.com> | 2010-04-15 09:16:29 +0200 |
---|---|---|
committer | Jon Olav Hauglid <jon.hauglid@sun.com> | 2010-04-15 09:16:29 +0200 |
commit | 48ac4ff51f7391d4dd0826e0adebda2e24bc3feb (patch) | |
tree | 79d1f64b3f5faab0279daf4bf632c600bc4d1e7c /mysql-test | |
parent | d3d459a72c8a1b2f972560a77e2296db14df4a84 (diff) | |
download | mariadb-git-48ac4ff51f7391d4dd0826e0adebda2e24bc3feb.tar.gz |
Bug #51327 MyISAM table is automatically repaired on ALTER
even if myisam-recover is OFF
The problem was that a corrupted MyISAM table was auto repaired
even if the myisam_recover_options server variable (or the
myisam_recover option) was set to OFF.
The reason was that the auto_repair() function, which is supposed
to say if auto repair is to be used, did not use the server variable
setting correctly. This bug was a regression introduced by WL#4738.
This patch fixes the problem by making sure auto_repair() returns
FALSE if myisam_recover_options is set to OFF.
Test case added to myisam.test.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/myisam.result | 33 | ||||
-rw-r--r-- | mysql-test/t/myisam.test | 31 |
2 files changed, 64 insertions, 0 deletions
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index df53b1d1480..73cf5df0304 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -2342,3 +2342,36 @@ Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; End of 5.1 tests +# +# Bug#51327 MyISAM table is automatically repaired on ALTER +# even if myisam-recover is OFF +# +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'"); +# Test that we can exchange a crashed partition with a table +SELECT @@global.myisam_recover_options; +@@global.myisam_recover_options +OFF +CREATE TABLE t1 (a INT, KEY (a)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1), (2); +FLUSH TABLES; +# replacing t.MYI with a corrupt + unclosed one created by doing: +# 'create table t1 (a int key(a))' head -c1024 t1.MYI > corrupt_t1.MYI +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check warning 1 client is using or hasn't closed the table properly +test.t1 check error Size of indexfile is: 1024 Should be: 2048 +test.t1 check warning Size of datafile is: 14 Should be: 7 +test.t1 check error Corrupt +# Alter table should report error and not auto-repair the table. +ALTER TABLE t1 ENGINE = MyISAM; +ERROR HY000: Table 't1' is marked as crashed and should be repaired +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check warning Table is marked as crashed +test.t1 check warning 1 client is using or hasn't closed the table properly +test.t1 check error Size of indexfile is: 1024 Should be: 2048 +test.t1 check warning Size of datafile is: 14 Should be: 7 +test.t1 check error Corrupt +DROP TABLE t1; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 47f53cac9ee..6c3092b22b8 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1591,3 +1591,34 @@ DROP TABLE t1; --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; |