Mysql Redo log and the difference from binary log

Source: Internet
Author: User
Tags filegroup

Mysql Redo log and the difference from binary log(Turn http://blog.uouo123.com/post/623.html)

MySQL will have two files by default: Ib_logfile0 and Ib_logfile1, these two files are redo log files, or transaction logs.

Purpose of Redo log: redo log files can be useful in the event of an instance or media failure.

Each InnoDB storage engine has at least one redo log filegroup, with at least 2 redo log files under each filegroup, such as the default IB_LOGFILE0, Ib_logfile1. The InnoDB storage engine first writes redo log file 1, when the end of the file is reached, it switches to redo log file 2, and when redo log file 2 is also full, it will be switched to redo log file 1 again.

Parameters that affect the redo log:

Innodb_log_file_size, Innodb_log_files_in_group, innodb_log_group_home_dir effects focus on the properties of the log file.

The difference between a redo log and a binary log:

1) The binary log records all mysql-related log records, including the logs of other storage engines such as InnoDB, while the redo log of the InnoDB storage engine records only the transaction logs about itself.

2) The content of the record is not allowed, regardless of the format you set the binary log file to, it records the specific operation of a transaction, and the InnoDB storage engine's redo log file records the physical condition of each page change;

3) The write time is also different, the binary log file is recorded before the transaction commits, and during the process of the transaction, there are constantly redo log entries are written to the redo log file.

The conditions for writing redo log files on disk from the log buffer:

The redo log buffers are written to the disk's redo log file every second in the main thread, regardless of whether the transaction is committed or not. Another trigger this process is controlled by the parameter innodb_flush_log_at_trx_commit, which indicates how the redo log is handled at commit time.

Parameter innodb_flush_log_at_trx_commit can be set to a value of 0, 1, 2, 0 means that when a transaction is committed, the redo log of the transaction is not written to the log file on disk, but instead waits for the main thread to refresh every second. The difference between 1 and 2 is that 1 is to write the redo log buffer synchronously to the disk at commit, and 2 is to write the redo log asynchronously to the disk, that is, the redo log file is not guaranteed to be fully committed when commit, but only with this action.

Note: Because the redo log has a capacity variable, this value indicates that the last checkpoint cannot exceed this threshold.

Mysql Redo log and the difference from binary log

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.