Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the meaning of the existence of MySQL double write

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

MySQL double write existence is what kind of significance, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Background:

MySQL defaults to 16k per page size, while OS usually has a minimum of 4k, so it may take four times to call OS IUnip O when writing page. Suppose you DB crash twice, and the page writes only part of it, resulting in a partial write (incomplete write).

The setting of MySQL double write is to ensure that the data that has been commit is not lost and the data file is not corrupted when partial write occurs.

Doubt:

MySQL double write has introduced it in many articles, but there are some problems in the process of understanding:

Since writing double write buffer is also writing hard disk ibdata1 file, what's the difference between this piece and writing directly. Ibd file?

To write double write buffer is to write 16k page, and it is possible to split, right?

Just because it is faster to write double write buffer sequentially?

Answer the question:

In fact, the main existing mechanism of MySQL double write is when restoring:

1 > .ibd data file page can be recovered from double write file in case of incomplete partial write write

2 > when the double write file page is damaged, because the .ibd data file has not been modified, you can directly use the redo already commit to restore the roll forward.

3 > will partial write occur in redo page? Redo page size is 512 bytes less than 4k os minimum io will not have partial write problem

Above, consider that if there is no double write mechanism, only .ibd files exist, and there is no place to recover directly when partial write is not fully written.

Attached picture:

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report