1 message in com.mysql.lists.mysqlextra bytes added to large BLOB by my...
FromSent OnAttachments
Zhe Wang28 Apr 2005 09:11 
Subject:extra bytes added to large BLOB by mysqldump
From:Zhe Wang (zwa@blueprint.org)
Date:04/28/2005 09:11:56 AM
List:com.mysql.lists.mysql

Hi, there,

I am using MySQL 4.1.10. I have a table which has a LONGBLOB field. Some length of the blob field of the records varies from a few hundred bytes to more than 64 MB. I've set max_allowed _packet to 128M on the server side. I first created the table in MyISAM and the data was added to the table successfully. Then I decided to convert the table to InnoDB. Since the table is very large (data alone is 90 G), it would take days to do so by "alter table mytable type=InnoDB", I decided to dump the data out using mysqldump then imported into a newly created InnoDB table. Here is the mysqldump command I used:

mysqldump -u u -p -P 3306 -h host --add-locks --complete-insert --extended-insert --no-create-info --quick --max_allowed_packet=128M mydb mytable > mytable.sql

I imported the data into the InnoDB table by: mysql -u u -p -P 3306 -h host mydb mytableInno < mytable.sql

I have a script which parse the content of the LONGBLOB field. This script was able to parse the data in the MyISAM table I first built but failed on some of the records in the InnoDB table. When I checked the length of the LONGBLOB field of the records which couldn't be parsed by my script, I found all of them of length above 15MB. Then I compared the lengths of such records in the MyISAM and InnoDB tables, I found that those in InnoDB were one or two bytes longer than those in MyISAM table.

Since the data in my InnoDB table was imported from a mysql data dump, I was wondering if these extra bytes were introduced by mysqldump, either at dumping out or importing back or both.

I know that I could avoid such problem by populating the InnoDB table from scratch. However, I want to find out if mysqldump does something weird to a large LONGBLOB.

I would greatly appreciate if someone can give me some hint. Thank you in advance!

Regards, Zhe