Home > database >  The mysql logfile
The mysql logfile

Time:09-30

I always thought that mysql logfile, is under the data file that a few ib_logfile is on a hard disk, but today to see about innodb_flush_log_at_trx_commit lost after the interpretation of the parameters, including a explanation is as follows:
With a value of 2, the contents of the InnoDB log buffer are written to the log file after each transaction commit and the log file is flushed to disk approximately once per second . Once - per - second flushing is not 100% guaranteed to happen every second, due to the process scheduling issues. Because the flush to disk operation only occurs approximately once per second, you can lose up to a second of the transactions in an operating system crash or a power outage.
I feel very strange, here mean is: logfile is reside in memory (or file system cache? , is set to 2 from the log buffer into the logfile first, after again from the cache on the logfile logfile written to the disk? Logfile

CodePudding user response:

Shouldn't be the log buffer flush directly to the disk on the logfile, how see website to explain more than a middle layer

CodePudding user response:

The building Lord this link explains it is quite clear:
http://blog.csdn.net/liqfyiyi/article/details/51137764
Write just write the operating system's memory, brush is persisted to disk, will set to 2 at the time of transaction commit wrote the content of the operating system, but the refresh or per second, when power is also likely to lose more than a second transaction,

CodePudding user response:

Reply upstairs:
The original English fragment is above 5.6 version of the website,
On consulting a large amount of information in both English and Chinese, and make the following conclusion: I am
Under the premise of the website is correct, the 'log buffer are written to the log file' refers to call write () method will redo log buffer to the OS file system caching, 'the log file is flushed to disk "refers to call fsync () method to write the file system cache into the disk, which means that the inside of the log file is refers to the file system cache in the log file, in the log file on the disk files are directly built in the past with disk,
This means that mysql writing log will also consider the file system cache this layer, it may also be because oracle and essentially a source is not open, this part directly ignored by others,

CodePudding user response:

This I also haven't understand
I understand it seems myql took over the disk cache
Linux not too clear, Windows disk cache this dongdong, write files to write this, then from the real to disk (physical write)

CodePudding user response:

To turn over the document again, just now I said earlier should be wrong, should be mysql own buffer

The innodb_flush_method options for Unix - like systems include:
Fsync: InnoDB USES the fsync () system call to flush both the data and log files. The fsync is the default setting.

The innodb_flush_method options for Windows systems include:
Async_unbuffered: InnoDB USES Windows asynchronous I/O and non - buffered I/o. async_unbuffered is the default setting on Windows systems.

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - this shows that the default is to use the flush of the operating system, then the buffer mysql has nothing to do with flush of the operating system when the buffer is the

CodePudding user response:

reference 5 floor ZJCXC reply:
just turned over the document again, should be in front of me said is wrong, should be a mysql own buffer

The innodb_flush_method options for Unix - like systems include:
Fsync: InnoDB USES the fsync () system call to flush both the data and log files. The fsync is the default setting.

The innodb_flush_method options for Windows systems include:
Async_unbuffered: InnoDB USES Windows asynchronous I/O and non - buffered I/o. async_unbuffered is the default setting on Windows systems.

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - this shows that the default is to use the flush of the operating system, then the buffer mysql has nothing to do with flush of the operating system when the buffer is the

Morning I summed up a blog, a temporary plan so understanding: http://www.cnblogs.com/leohahah/p/8176553.html
  • Related