Search code examples
mysqlredo

What is the difference between redo log and doublewirte buffer in MySql InnoDB?


Before, I thought redo log was used to recovery the database when crash happened. But I felt I was wrong when I saw the note as follows:

crash recovery

The cleanup activities that occur when MySQL is started again after a crash. For InnoDB tables, changes from incomplete transactions are replayed using data from the redo log. Changes that were committed before the crash, but not yet written into the data files, are reconstructed from the doublewrite buffer. When the database is shut down normally, this type of activity is performed during shutdown by the purge operation.
During normal operation, committed data can be stored in the change buffer for a period of time before being written to the data files. There is always a tradeoff between keeping the data files up-to-date, which introduces performance overhead during normal operation, and buffering the data, which can make shutdown and crash recovery take longer. See Also change buffer, commit, crash, data files, doublewrite buffer, InnoDB, purge, redo log.
it is from mysql refman-5.7-en.pdf.

If it is real, I don't know what use redo log has. Because, when crash happens, mysql can recovery itself through doublewrite buffer. It seems redo log makes no sense. Maybe I ignore somewhere, but I don't know.
I want to know the difference between them and whether or not redo log is important to mysql InnoDB?


Solution

  • May be this blog post will answer your question:

    Click here