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 function of innodb_flush_method function in MySQL

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

Share

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

This article introduces the relevant knowledge of "what is the role of innodb_flush_method function in MySQL". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The parameter innodb_flush_method controls the opening and writing mode of the innodb data file and redo log. For this parameter, it is described as follows:

There are three values: fdatasync (default), Olympus DSYNCrect

The default is fdatasync. Call fsync () to brush the data file and buffer of redo log.

When O_DSYNC, innodb uses O_SYNC to open and write redo log, and fsync () to write data files

When O_DIRECT, innodb uses O_DIRECT to open the data file, and fsync () to swipe the data file and redo log

First of all, the write operation of the file includes three steps: open,write,flush

The fsync (int fd) function most often mentioned above is used to flush the buffer related to the file referred to in the fd file descriptor to disk, and flush completes the metadata information (such as modification date, creation date, etc.) before flush is successful.

Opening the redo file with O_SYNC means that when the write log is logged, the data is write to disk and the metadata needs to be updated before the success is returned.

O_DIRECT means that our write operation is written directly from mysql innodb buffer to disk.

At this point, I would like to summarize the three ways to write data:

Fdatasync mode: when writing data, the write step does not need to be actually written to disk (it may be written to the operating system buffer and the completion will be returned). The real completion is the flush operation, and the buffer is handed over to the operating system to flush, and the metadata information of the file needs to be updated to disk.

O_DSYNC mode: log writing is done at write step, while data file writing is done through fsync at flush step.

O_DIRECT mode: the data file is written directly from mysql innodb buffer to disk, and does not need to be buffered by the operating system. The real completion is at the step of flush, and the log is buffered by OS.

This is the end of the content of "what is the function of innodb_flush_method function in MySQL". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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