High CPU useage on full disk
Bug #1304310 reported by
David Busby
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MySQL Data Dumper |
New
|
Undecided
|
Unassigned |
Bug Description
When facing a full disk for the target location of the resulting backup files, mydumper will end up in a rapid retry loop attempting to write data to disk.
This can be observed with strace when the disk is full mydumper will consume 100% CPU
write(3, "******
ENOSPC (No space left on device)
Mydumper will continually attempt to write data out where as it should probably abort entirely on full disk.
To post a comment you must log in.
The problem is the `write_data` function at the end of `mydumper.c`. It has a loop that runs until all requested bytes have been written, and it has two bugs: refspecs. linuxbase. org/LSB_ 3.0.0/LSB- Core-generic/ LSB-Core- generic/ zlib-gzwrite- 1.html
a) It only catches the case of `write` or `gzwrite` returning -1, but `gzwrite` can also return zero in case of an error: http://
b) If not all requested bytes are written, the next loop iteration will try to write the same number of bytes again, starting from a different memory position. It will read past the buffer of data to write. Apparently this never happened.
I've attached a patch that fixes this. (The `FindMySQL.cmake` is also severely broken, but I circumvented the problems by manually editing the `CMakeCache.txt`.)