1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.
This commit is contained in:
Jon Olav Hauglid
2010-04-15 09:16:29 +02:00
parent d18275c2c2
commit e232fbe067
3 changed files with 67 additions and 3 deletions

View File

@ -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;