Bug #81346 wait_for_free_space sends address of my_errno instead of calling it to get errno
Submitted: 8 May 2016 14:51 Modified: 6 Jan 2017 19:09
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.7, 8.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: regression

[8 May 2016 14:51] Shane Bester
Description:
Affects 5.6, 5.7, 5.8

In error log... notice the weird errcode....

Disk is full writing '.\i7-bin.000007' (Errcode: 1078388320 - No space left on device). Waiting for someone to free space...
Retry in 60 secs. Message reprinted in 600 secs
Disk is full writing '.\i7-bin.000007' (Errcode: 1078388320 - No space left on device). Waiting for someone to free space...
Retry in 60 secs. Message reprinted in 600 secs

After the fix,  we get expected results:

[ERROR] Disk is full writing '.\i7-bin.000008' (Errcode: 28 - No space left on device). Waiting for someone to free space...
[ERROR] Retry in 60 secs. Message reprinted in 600 secs

How to repeat:
code inspection, or fill your disk and check error message.

Suggested fix:
E:\git\mysql-trunk\mysys>git diff
diff --git a/mysys/errors.cc b/mysys/errors.cc
index 828eeba..86b1e98 100644
--- a/mysys/errors.cc
+++ b/mysys/errors.cc
@@ -77,7 +77,7 @@ void wait_for_free_space(const char *filename, int errors)
   {
     char errbuf[MYSYS_STRERROR_SIZE];
     my_message_local(ERROR_LEVEL, EE(EE_DISK_FULL),
-                     filename,my_errno,
+                     filename,my_errno(),
                      my_strerror(errbuf, sizeof(errbuf), my_errno()));
     my_message_local(ERROR_LEVEL,
                      "Retry in %d secs. Message reprinted in %d secs",
[5 Nov 2016 15:13] Shahriyar Rzayev
What will be the updated version?

https://github.com/mysql/mysql-server/blob/5.6/mysys/errors.c

void wait_for_free_space(const char *filename, int errors)
{
  if (!(errors % MY_WAIT_GIVE_USER_A_MESSAGE))
  {
    char errbuf[MYSYS_STRERROR_SIZE];
    my_printf_warning(EE(EE_DISK_FULL),
             filename,my_errno,my_strerror(errbuf, sizeof(errbuf), my_errno));
    my_printf_warning("Retry in %d secs. Message reprinted in %d secs",
                    MY_WAIT_FOR_USER_TO_FIX_PANIC,
                    MY_WAIT_GIVE_USER_A_MESSAGE * MY_WAIT_FOR_USER_TO_FIX_PANIC );
  }
  DBUG_EXECUTE_IF("simulate_no_free_space_error",
                 {
                   (void) sleep(1);
                   return;
                 });
  (void) sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC);
}
[5 Nov 2016 15:18] MySQL Verification Team
oops, we found it only affects 5.7
[5 Nov 2016 15:20] MySQL Verification Team
https://github.com/mysql/mysql-server/blob/5.7/mysys/errors.c#L74
https://github.com/mysql/mysql-server/blob/8.0/mysys/errors.cc#L78
[6 Jan 2017 19:09] Paul DuBois
Posted by developer:
 
Noted in 8.0.1 changelog.

An instance of the disk-full error message contained the wrong error
code.