Bug #24413 Misleading error message when hard drive is full
Submitted: 18 Nov 2006 12:56 Modified: 3 Dec 2006 12:51
Reporter: Philip Stoev Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S3 (Non-critical)
Version:5.0.32-BK, 5.0.26 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[18 Nov 2006 12:56] Philip Stoev
Description:
Hello,

It appears that this query

select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;

causes MySQL to eat up all the available disk space and output the error

ERROR 126 (HY000): Incorrect key file for table '/tmp/#sql_fca_0.MYI'; try to repair it

The query and the tables are found in the select.test from the mysql test distribution (see below). I am not sure if is OK for this query to eat up 700 megabytes of disk space, however even if it is OK, at least the error message should be more descriptive and say that there is not enough disk space. The mysql.err log shows the same message without further information.

How to repeat:
Convert the EXPLAIN SELECTs from select.test into normal SELECTs and run the new test.

# cd /usr/src/mysql-5.0.26/mysql-test/
# sed -e 's/explain select/select/g' t/select.test > t/select-no-explain.test
# ./mysql-test select-no-explain

[root@irena mysql-test]# ./mysql-test-run select-no-explain
Logging: ./mysql-test-run select-no-explain
Installing Test Databases
Removing Stale Files
Installing Master Databases
running  ../sql/mysqld --no-defaults --bootstrap --skip-grant-tables     --basedir=. --datadir=./var/master-data --skip-innodb --skip-ndbcluster --skip-bdb     --language=../sql/share/english/ --character-sets-dir=../sql/share/charsets/
Installing Slave Databases
running  ../sql/mysqld --no-defaults --bootstrap --skip-grant-tables     --basedir=. --datadir=./var/slave-data --skip-innodb --skip-ndbcluster --skip-bdb     --language=../sql/share/english/ --character-sets-dir=../sql/share/charsets/
Manager disabled, skipping manager start.
Loading Standard Test Databases
Starting Tests

TEST                            RESULT
-------------------------------------------------------
select-no-explain              [ fail ]

Errors are (from /usr/src/mysql-5.0.26/mysql-test/var/log/mysqltest-time) :
mysqltest: At line 1453: query 'select * from t3 as t1,t3 where t1.period=t3.period order by t3.period' failed: 126: Incorrect key file for table '/usr/src/mysql-5.0.26/mysql-test/var/tmp/#sql_769a_0.MYI'; try to repair it
(the last lines may be the most important ones)

Aborting: select-no-explain failed in default mode. To continue, re-run with '--force'.

Suggested fix:
If the query is indeed OK and should really consume that much disk space, than at least the error message should be made more descriptive. If it is impossible to return a nice error message all the way up to the caller, than at least the log should offer some clue that the hard drive is full.
[3 Dec 2006 12:51] Valeriy Kravchuk
Thank you for a bug report. Verified just as described with 5.0.32-BK on Linux.