High CPU useage on full disk

Bug #1304310 reported by David Busby
12
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, "***********************************"...,4096) = -1
ENOSPC (No space left on device)

Mydumper will continually attempt to write data out where as it should probably abort entirely on full disk.

Tags: disk full rdba
Revision history for this message
Jan Schlüter (f0k) wrote :

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:
a) It only catches the case of `write` or `gzwrite` returning -1, but `gzwrite` can also return zero in case of an error: http://refspecs.linuxbase.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/zlib-gzwrite-1.html
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`.)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.