InnoDB source code analysis-transaction log (1), innodb source code

Source: Internet
Author: User

InnoDB source code analysis-transaction log (1), innodb source code

Original article, reprinted please indicate the original link (http://www.cnblogs.com/wingsless/p/5705314.html)

In the previous article "InnoDB WAL learning" (http://www.cnblogs.com/wingsless/p/5203064.html), I analyzed what WAL is, the timing of triggering, recently just in the view of the redo log source code, let's talk about this again.

1. Log write time

Everyone knows this parameter: innodb_flush_log_at_trx_commit, which is used to control the time when the content in the redo buffer is written into the log. Generally, this parameter is divided into two parts: redo buffer writing to log file; OS cache/buffer flushing into disk. I drew a simple example:

I am a little confused after drawing this image, because there is another parameter: innodb_flush_method. We usually choose O_DIRECT. What is the relationship between this parameter and the above parameter? From the parameter perspective, it seems that this parameter specifies how to flush. If so, what will the above figure look like?

Ii. Some ghosts in the Linux Kernel

So I borrowed a book about the Linux kernel. From this book, I probably know that O_DIRECT is a file opening method, that is, the process directly obtains the file content without going through the system cache. Then I read the MySQL documentation, which clearly tells me that after I use O_DIRECT, the data file will be opened in O_DIRECT mode, but I still need to use fsync () the function fl data and logs back to the disk. In fact, I think there are some problems with the name of this parameter. This parameter does not only specify the flush method, but also includes the method for opening a file. You can draw a picture like this:

This is the supplemental version of the figure above.

InnoDB is still very fun. Recently I have been sorting out the source code Study Notes and transaction logs. It is worth writing something here. It is not very painful to read the source code after learning these basic knowledge background.

Original article, reprinted please indicate the original link (http://www.cnblogs.com/wingsless/p/5705314.html)

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.