Bug #1581 Misleading error when slow query log cannot be written
Submitted: 16 Oct 2003 15:48 Modified: 23 Feb 2004 10:44
Reporter: Ilia Alshanetksy Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:3.23.58 OS:Linux (Linux 2.4.21)
Assigned to: Assigned Account CPU Architecture:Any

[16 Oct 2003 15:48] Ilia Alshanetksy
Description:
When a slow queries are being logged and upon failure to write to the log due to disk space constraints mysql returns error 28 (normally indicating that there is not space). However, in this case error is misleading because there is plenty of room in the place where the actual tables are stored, only the partition where the slow query log is stored is out of space. Ideally there would be a seperate error code for this situation.

How to repeat:
Execute slow queries until there is no more free space on the paritition where the slow query log is being written to.
[17 Oct 2003 0:15] Alexander Keremidarski
I disagree with you.

perror 28 is 
Error code  28:  No space left on device

Note that it only indicates the problem without specifying which filesystem is out of space.

MySQL can operate on as many filesystems as administrator chooses. Every database for example can be symlinked to different filesystem and even tables data and indexes can be split into different filesystems.

Having separate error message for log files directory does not solve anything in such scenario.
[17 Oct 2003 4:55] Ilia Alshanetksy
When you get an error 28 performing a SELECT it's fairly reasonable to assume that the problem lies with the table storage or temporary directory. Considering the slow query log or any other log is completely unintuitive in this case.
[24 Nov 2003 7:47] MySQL Verification Team
Sergei, please comment this. I understand that Ilia meant that
the message error should be accompanied with a complementary text
indicating while creating temporary files.
[2 Dec 2003 6:05] Alexander Keremidarski
Ilia,

Can you please describe where did you get that message and what exactly the text of error message was?

perror 28 can be returned as a part of various MySQL error messages that's why it is important to know which one it was.

Also you should not get this such message in client. If you got it sent to client most probably it is either bug (which has to be fixed) or it was caused by something else like Log files sharing same filesystem with tmpdir where query needed to put temporary table.

Correct behaviour of MySQL in situation where only log file can't be written is:

Don't send any error to client (as result of query is not affected by logging)

Write down in .err log message like:

031202 15:19:12  Error writing file '/tmp/slow.log' (errno: 1)
031202 15:19:19  Could not use /tmp/slow.log for logging (error 28). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.

I hope you will agree this message is quite descriptive.

Side note perror codes like 28 are sent to MySQL by underlying OS so we can't add anything there /rewrite them. 

(errno: N) should be read as "Operating system returns perror code N"
[23 Feb 2004 10:44] Sergei Golubchik
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.