What happens to MySQL when the disk space is full?
Guide
What happens to MySQL when the disk space is full? What should I do?
What will happen
When the disk space is full, MySQL cannot write any data, including writing data to the table and binlog, binlog-index, and other files.
Of course, because InnoDB can put dirty data in the memory first, it does not immediately show that it cannot be written, unless binlog is enabled, write requests will be blocked.
When MySQL detects that the disk space is full, it will:
- Per minute: Check whether the space is released to write new data. When the remaining space is found, the data will continue to be written.
- Every 10 minutes: If no space is found, a record is written into the log to report that the disk space is full (at this time, only a few bytes are enough ).
What should I do?
So what should we do when we find that the disk space is full? we suggest:
- Increase the frequency of monitoring system detection to prevent recurrence;
- Delete unnecessary files in time to release space;
- If a thread is blocked because the disk is full, it can be killed first. It may work again when it is detected again in the next minute;
- Some threads may be blocked because the disk is full, and other threads may be blocked. You can kill the thread that causes blocking, and other blocked threads will continue to work.
Exceptions
An exception is:
When the repair table or optimize table operation is performed, or the index is updated in batches after the load data infile or alter table operation is executed, these operations will create temporary files, when mysqld finds that the disk space is full during these operations, it will mark the involved TABLE as crashed and delete the temporary file (except for the alter table operation, mySQL will discard ongoing operations, delete temporary files, and release disk space ).
Note: When the mysqld process is accidentally killed during execution of these commands, the generated temporary files will not be automatically deleted and need to be deleted manually to release the disk space.
This article permanently updates the link address: