Bug #73365 | InnoDB: 1048576 bytes should have been written, only -1 were written | ||
---|---|---|---|
Submitted: | 23 Jul 2014 12:32 | Modified: | 10 Dec 2014 18:58 |
Reporter: | Shahriyar Rzayev | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S1 (Critical) |
Version: | 5.6.19 | OS: | Linux (CentOS 6.5) |
Assigned to: | CPU Architecture: | Any |
[23 Jul 2014 12:32]
Shahriyar Rzayev
[24 Jul 2014 16:02]
David Bennett
The -1 value is an error return from the os_file_pwrite() function in storage/innobase/os/os0file.c. This only occurs on non-Windows platforms. On Windows the WriteFile functions _Out_opt_ lpNumberOfBytesWritten is used which will return 0 on error. A patch is attached which will correct the error message.
[24 Jul 2014 16:06]
David Bennett
Patch to fix the reported bytes written to zero on os_file_pwrite() error.
Attachment: mysql_bug_73365.patch (text/x-patch), 362 bytes.
[25 Jul 2014 7:40]
Shahriyar Rzayev
Yes after applying patch message in error log changed: InnoDB: 1048576 bytes should have been written, only 0 were written. InnoDB: Operating system error number 28. InnoDB: Check that your OS and file system support files of this size. InnoDB: Check also that the disk is not full or a disk quota exceeded. InnoDB: Error number 28 means 'No space left on device'. InnoDB: Some operating system error numbers are described at It was really very interesting. Thank You.
[29 Jul 2014 18:09]
Sveta Smirnova
Thank you for the report. Verified as described: os_file_pwrite returns -1 in case if lseek fails with error or in case if pwrite fails with error (os_file_pwrite returns value of pwrite which is -1 in case of error).
[29 Jul 2014 18:11]
Sveta Smirnova
David, in order for us to accept your patch please sign Oracle Contributors Agreement as described in the "Contributions" tab.
[31 Jul 2014 5:42]
David Bennett
Sveta, You should already have one on file for me. I contributed to the Jersey project recently. I believe that David Delabassee approved it on April 2nd, 2014.
[10 Dec 2014 18:58]
Daniel Price
Posted by developer: Fixed as of the upcoming 5.6.23, 5.7.6 releases, and here's the changelog entry: On non-Windows platforms, "os-file_pread" and "os_file_pwrite" functions return -1 when an error occurs. This value was printed in an error message as the number of bytes read or written. Instead of printing the -1 value in the error message, a separate error message indicating a system call failure is now printed. Thanks to David Bennett for the patch.
[12 Feb 2015 13:27]
Laurynas Biveinis
$ git show -s ae0f4c1 commit ae0f4c17c82d1d3ee89ca5afb64655b4ab1d2552 Author: aditya.a <aditya.a@oracle.com> Date: Mon Dec 8 18:17:02 2014 +0530 Bug#19315210 INNODB: 1048576 BYTES SHOULD HAVE BEEN WRITTEN, ONLY -1 WERE WRITTEN PROBLEM ------- os-file_pread /os_file_pwrite functions return -1 when an error occurs and is printed in error message as the number of bytes read/written which is confusing to the user. FIX --- If -1 is returned print a seperate error message indicating system call failure [Approved by Jimmy #rb7475 and #rb7455 ]