Bug #7714 if disk full, sometimes MyISAM doesn't wait for free space, corrupts table
Submitted: 6 Jan 2005 20:13 Modified: 6 Jan 2005 20:39
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S3 (Non-critical)
Version:4.0.23 OS:Any (all)
Assigned to: Guilhem Bichot CPU Architecture:Any

[6 Jan 2005 20:13] Guilhem Bichot
Description:
mysqld is running as a user which has a quota; a large INSERT is running; instead of  blocking (waiting for free space) when quota is exceeded, the INSERT terminates with:
ERROR 1030 (HY000) at line 1: Got error 127 from storage engine
and a CHECK TABLE then:
+--------+-------+----------+---------------------------------------------------+
| Table  | Op    | Msg_type | Msg_text                                          |
+--------+-------+----------+---------------------------------------------------+
| test.t | check | error    | Size of datafile is: 8192         Should be: 8280 |
| test.t | check | error    | Corrupt                                           |
+--------+-------+----------+---------------------------------------------------+
This happens only if the write() cannot even write one byte.

How to repeat:
see description

Suggested fix:
my_write() is the only buggy place; it has a test for writenbytes != -1, to be removed.
[6 Jan 2005 20:17] Guilhem Bichot
After the pending fix, we see the INSERT block and this message goes to error log:
50106 16:49:21 [ERROR] /home/mysql_src/mysql-4.1-clean/sql/mysqld: Disk is full writing './test/t.MYD' (Errcode: 122). Waiting for someone to free space... Retry in 60 secs
[6 Jan 2005 20:39] Guilhem Bichot
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:

Fixed in 4.0 in ChangeSet@1.2022, 2005-01-06 21:30:39+01:00, guilhem@mysql.com