I am running MySQL 3.23.32 on Linux 2.2.16 with large file support. Large 
tables (tens of GB) work fine. mysqladmin variables shows large file support 
is enabled.
The problem I am having showed up when I loaded a bunch of data into a simple 
non-indexed table and then tried to do the following to build the indexes:
(NOTE: the reason I do it this way is to hopefully increase speed since I know 
ALTER TABLE makes a complete copy of the table and this table is over 8GB)

mysqladmin flush-tables
cd ~mysql/Database/
mv table.MYD table.MYD.saved
SQL> truncate table;
SQL> ALTER TABLE table ADD PRIMARY KEY (field1, field2);
SQL> ALTER TABLE table ADD INDEX indexname (field2);
mysqladmin flush-tables
mv table.MYD.saved table.MYD
myisamchk -t /db/ -r -q -O sort_buffer_size=512M table.MYI

The output/error I get is:
- check key delete-chain
- check record delete-chain
- recovering (with sort) MyISAM-table 'RawMatch.MYI'
Data records: 201326371
- Fixing index 1
myisamchk: Error writing file '/db/STAHOIjf' (Errcode: 27)
myisamchk: error: 27 when fixing table
MyISAM-table 'RawMatch.MYI' is not fixed because of errors
Try fixing it by using the --safe-recover (-o) option

I looked up error 27 using the perror tool and got:
Error code  27:  File too large

Now, this filesystem definately has large file support since there are already 
files over 2GB on it that work. It also has plenty of free space. I made sure
to direct the temporary files to a partition with space.

So my question is, why is this happening? How can I fix it? I haven't tried 
safe-recover yet as I get the impression it would take a LONG time to complete,
and although the documentation says it uses less disk space, I don't know if 
it would help.

I am now just going to do the alter table on the full database, which will 
mean it makes a full copy, inefficient, but hopefully it will work.

But I would like to know what causes this error and what I can do to fix it.
Are there other good ways of importing lots of data into a table and then 
building the index later?

Thanks,
Chris

PGP signature

Reply via email to