Bug #9557 MyISAM utf8 table crash with importing sth...
Submitted: 1 Apr 2005 14:26 Modified: 7 Jul 2005 13:00
Reporter: yingbo qiu Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S1 (Critical)
Version:4.1.10a / 4.1.11 / 4.1.12 OS:Linux (redhat or freebsd)
Assigned to: Alexander Barkov CPU Architecture:Any
Tags: corruption, myisam

[1 Apr 2005 14:26] yingbo qiu
Description:
I want to use mysql 4.1's charset feature to convert GBK charset data to UTF-8 data,and the table will crash when I import old data. I use the MySQL Server that download from mysql.com,mysql-max-4.1.10a-pc-linux-gnu-i686.tar.gz and mysql-max-4.1.10a-unknown-freebsd4.7-i386.tar.gz. The two packages have the same problem.

now I can repeat the crash with two insert sql lines.

How to repeat:
drop table test;
CREATE TABLE `test` (
  `ID` int(32) NOT NULL auto_increment,
  `UserID` int(32) NOT NULL default '0',
  `Title` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`ID`),
   KEY `UserID` (`UserID`),
  KEY `Title` (`Title`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;

SET character_set_client = gbk;
SET character_set_connection = utf8;
insert into test (userid,  title) values ('8', '‖耽');
insert into test (userid,  title) values ('9', '‖[');

check table test;

Suggested fix:
the table will not crash if I remove any charset related feature, the table's default charset, set charset_set_client or set charset_set_connection
[1 Apr 2005 14:29] yingbo qiu
sql statement that kill table

Attachment: minicrash.sql (application/octet-stream, text), 492 bytes.

[1 Apr 2005 14:34] yingbo qiu
how to repeat the bug:

the bug input form convert my GBK data to unicode, I have upload a attachment sql file.
[7 Apr 2005 1:31] yingbo qiu
iconv the minicrash.sql to minicrash2.sql

Attachment: minicrash2.sql (application/octet-stream, text), 455 bytes.

[7 Apr 2005 3:18] yingbo qiu
I repeat the bug in mysql 4.11.

if the table type set to InnoDB, the table will not be corrupt.

I use iconv tool convert the GBK minicrash.sql to UTF8 minicrash2.sql.
[7 Apr 2005 6:47] Jorge del Conde
Hi, I was unable to reproduce this bug using a recent build from our bk tree:

mysql> check table test;
+-----------+-------+----------+----------+
| Table     | Op    | Msg_type | Msg_text |
+-----------+-------+----------+----------+
| test.test | check | status   | OK       |
+-----------+-------+----------+----------+
1 row in set (0.00 sec)
[7 Apr 2005 10:38] yingbo qiu
but the bug could be reproduce in my environment.

I get the mysql-4.1 source from bk server, 

===================================================
>head  mysql-4.1/BK/ChangeLog
ChangeSet
  2005/04/06 11:02:20-07:00 jimw@mysql.com
  Merge mysql.com:/home/jimw/my/mysql-4.0-clean
  into mysql.com:/home/jimw/my/mysql-4.1-clean

client/mysqlcheck.c
  2005/04/06 11:02:19-07:00 jimw@mysql.com +0 -0
  Auto merged

mysys/my_rename.c
===================================================

>cd mysql-4.1
>aclocal; autoheader; autoconf; automake
>./configure --prefix=/usr/local/mysql --without-innodb
>make
>su
#make install
#cd /usr/local/mysql/
#bin/mysql_install_db
#bin/mysqld_safe --user=root&
#bin/mysql             ..... create database abc;
#bin/mysql abc < /home/qyb/minicrash2.sql
Table   Op      Msg_type        Msg_text
abc.test        check   warning Table is marked as crashed
abc.test        check   error  Found key at page 1024 that points to record outside datafile
abc.test        check   error   Corrupt

===================================================
My environment

Debain Sarge daily update;
gcc/g++ 3.3.5
libc6 2.3.2

FreeBSD 5.3-Release
gcc/g++ 2.95.3    (pkg_add packages)
[23 May 2005 10:25] yingbo qiu
crash on 4.1.12 now......

freebsd 4.7
gcc version 2.95.4 20020320 [FreeBSD]
[28 Jun 2005 9:40] Alexander Barkov
I reproduced the same problem. Fixing.
[28 Jun 2005 10:01] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/26478
[28 Jun 2005 10:06] Alexander Barkov
Fixed.
Monty approved the fix on IRC.
Pushed into 4.1.13 tree.
[7 Jul 2005 13:00] Jon Stephens
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

DOcumented in 4.1.13 change history; closed.