• notice
  • Congratulations on the launch of the Sought Tech site

Redo Log persistence process

Redo Log's brushing rules:

In the MySQL engine, redo log is used to ensure the atomicity and durability of transactions.


Today, let’s take a concrete look at how to write the log cache redo log Buffer into the redo log file in the redo log.


Under normal circumstances, for the usual transaction commit, it is divided into three stages:


  • The transaction is ready to commit:

  • During the transaction commit process:

  • Transaction commit is completed: The main process is that when the transaction is committed, the data in the log cache of the redo log buffer will be forced to be written into the redo log file.Usually, the fsync() operation of the operating system is called once.


Which will also pass through the kernel space of the operating system, OS buffer, because MySQL's progress and log cache work in the operating system environment


Nature:


In the process of transaction commit, the data in the log cache must be persisted to the log file on the disk, and during the process, it needs to pass through the "kernel space buffer area" of the operating system - that is, the OS Buffer area.


When the Redo log is written from the Log buffer in the user space to the Redo Log file on the disk,


Need OS buffer with kernel space;


The log file does not use the O_DIRECT flag.If there is this flag, you can directly write data to the disk without passing through the kernel space of the os buffer;

Precautions:

For redo log to maintain persistence, it is necessary to cache the log and write it to disk.Usually this redo buffer will detect how much current data is.If it exceeds half, it will trigger the flashing operation, that is, it will continue to write the data to disk.The operation;


When there is a checkpoint in the transaction at that time, it represents the location of the LSN where the disk log is flushed, and the logical sequence number of the log;

Schematic diagram of redo log persistence from log redo buffer to redo log file

Persist from the log cache to the kernel space os buffer --->file file;




Tags

Technical otaku

Sought technology together

Related Topic

1 Comments

author

lipitor 80mg pill & lt;a href="https://lipiws.top/"& gt;generic atorvastatin 80mg& lt;/a& gt; lipitor 10mg cheap

Tlwesi

2024-03-07

Leave a Reply

+