Querying myisam table metadata may corrupt the table
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
New
|
High
|
Michael Widenius |
Bug Description
This is related to bug #925377, but confirmed on the 5.3.6 release.
Jervin R (viiin) wrote a reproducer which I have attached (myisam_crash.rb) and confirm causes the corrupt table message. We're seeing corrupt tables on our live databases as well.
This bug appears to be present still on 5.3.6 - possibly not during ENABLE|DISABLE keys but immediately before drop. see my.cnf below and Ruby script for test case.
[mysqld]
basedir=
datadir=
socket=
user=revin
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
collation_server = utf8_unicode_ci
character_
skip-external-
#fast_index_
# 10MB ramdisk - can be ignored
tmpdir = /tmpfs
key_buffer = 276M
innodb_
max_allowed_packet = 16M
thread_stack = 256K
thread_cache_size = 128
thread_concurrency = 8
max_connections = 512
table_cache = 2048
myisam-recover = BACKUP
query_cache_limit = 1M
query_cache_size = 128M
expire_logs_days = 10
max_binlog_size = 100M
[mysqld_safe]
log-error=
pid-file=
Produces the output:
120426 11:32:39 [ERROR] mysqld: Table './test/customerXX' is marked as crashed and should be repaired
The problem is also reproducible with the MTR test case provided in the original bug report (I will paste it again here). share-> unique_ file_name, filename) || share-> last_version' failed) is still observed, and there is no commit for bug #925377 in the tree history, apparently it was only pushed into 5.3.
The behavior is different on 5.1/5.2 and 5.3 now. On 5.3 the assertion failure seems to have been fixed, although the corruption messageis still reproducible. On 5.1 and 5.2 debug versions the original assertion failure (Assertion `strcmp(
# MTR test case:
--connect( con1,localhost, root,,)
--perl
open( DATA, ">bug925377.txt" )
|| die "Couldn't open file bug925377.txt for writing: $!";
foreach my $i ( 1..100000 )
{
print DATA "$i,line number $i\n";
}
close( DATA );
EOF
--disable_warnings
DROP TABLE IF EXISTS bug925377;
--enable_warnings
CREATE TABLE bug925377 (
id INT PRIMARY KEY,
a VARCHAR(100),
INDEX(a)
) ENGINE=MyISAM;
ALTER TABLE bug925377 DISABLE KEYS;
LOAD DATA LOCAL INFILE 'bug925377.txt'
INTO TABLE bug925377
FIELDS TERMINATED BY ',';
--send
ALTER TABLE bug925377 ENABLE KEYS;
--connection default wait_show_ condition. inc
--let $wait_timeout=10
--let $show_statement= SHOW PROCESSLIST
--let $field= State
--let $condition= = 'Repair by sorting'
--source include/
SHOW TABLE STATUS LIKE 'bug925377';
--connection con1
--reap
DROP TABLE bug925377;
# End of MTR test case