Home > Database > Mysql Tutorial > What happens to MySQL when the disk space is full?

What happens to MySQL when the disk space is full?

黄舟
Release: 2017-02-22 11:04:01
Original
1533 people have browsed it


Introduction

What will happen to MySQL when the disk space is full? How should we respond?

What will happen

When the disk space is full, MySQL cannot write any more data, including writing to table data. , as well as binlog, binlog-index and other files.

Of course, because InnoDB can store dirty data in memory first, it will not immediately show that it cannot be written. Unless binlog is turned on, the write request will be blocked.

When MySQL detects that the disk space is full, it will:

What should we do

So, what should we do when we find that the disk space is full? Suggestions :

  • Every minute: Check if space has been freed so new data can be written. When it is found that there is remaining space, data will continue to be written, and everything will continue as usual.

  • Every ten minutes: If it is still found that there is no remaining space, a record will be written in the log to report that the disk space is full (only writing a few bytes at this time is enough ).

  • Increase the detection frequency of the monitoring system to prevent recurrence;

  • Delete unused files in a timely manner to free up space;

  • If a thread is blocked due to the disk being full, it can be killed first, and it may be able to work normally again when re-detected the next minute;

  • Possibly Because the disk is full, some threads are blocked, causing other threads to be blocked. You can kill the blocking thread, and other blocked threads can continue to work.

Exceptions

There is an exception:

When executing REPAIR TABLE or OPTIMIZE TABLE operation, or after executing LOAD DATA INFILE or ALTER When updating the index in batches after TABLE, these operations will create temporary files. When performing these operations, mysqld finds that the disk space is full, and will mark the table involved as crashed and delete the temporary files (except for ALTER TABLE operations, MySQL The operation being performed will be abandoned, temporary files will be deleted, and disk space will be released).

Note: If the mysqld process is accidentally killed during the execution of these commands, the temporary files generated will not be automatically deleted and need to be deleted manually to free up disk space.

The above is what will happen to MySQL when the disk space is full. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template