MySQL Innodb_double_write features

Source: Internet
Author: User

Knowledge Reserve:

1, the MySQL crasy recovery is through the redo log and the undo log to complete;

2, redo log and undo log is the physical operation of the page, such as the 1024th page offset to 100, write ' Hello World ', which means redo log and Nudo log can be correctly

The completion is dependent on page, redo log and undo log will not work if the page itself is not correct!

3. Why is it impossible to proceed instead of MySQL according to redo log, undo log made a wrong result in page one? This is because each has an LSN number, which represents the last operation of this

The transaction ID of the page content, the LSN if it is not corresponding to the redo log, is not fixed in the Unod log.

Innodb_double_write:

Since redo log and nudo log already have, in order to ensure the correctness of the results, we just have to ensure that the page is correct, and the memory page is flushed to the table space This operation cannot be atomic,

Which means it's possible that this page, K, actually only writes 3,4 K. So how can we get a definite result in an uncertain environment? This is the key to Innodb_double_write,

InnoDB two steps to refresh memory.

The first step: Refresh the page to system table space.

Step two: On the basis of the successful completion of the first step, refresh the first step of the page into the Real table space page.

  

Completed the above two steps after the positive significance: can be successfully excluded page content only partially write to redo log Unod log In doing crash recovery effect; The page is also in two cases.

1, partial write, in this case InnoDB can still find a correct page from the system table space to complete the crash recovery.

2, if the page write completed, then InnoDB directly can use this page, so crash recovery can also be completed correctly.

Thinking:

As with the name double write, the amount of data written has changed from 1 copies to 2 copies, which does not mean that MySQL performance is down by 50%?

Optimization of the Innodb_double_write:

MySQL to Innodb_double_write is also go first write memory, sequential write, random write the old path.

1, first write memory:mysql in memory specifically opened 2MB for innodb_double_write of space called Double_write_buffer all to refresh Innodb_buffer_pool

The page in is written to this buffer first.

2. Refresh 1M from Double_write_buffer to system table space each time.

  The two steps are much smaller than the cost of the 3rd step, so the case of the account Innodb_double_write MySQL did not fall 50% so horrible!

MySQL Innodb_double_write features

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.