当前位置:网站首页>Three major logs in mysql

Three major logs in mysql

2022-08-10 23:11:00 Mu Xiaotong

redoLog

redoLog is a log specific to the InnoDB engine. Every time an operation is performed, the redoLog log will be written first.What is recorded is, at a certain time, what operations are done to which data in which data pages, and what values ​​are modified.This log is somewhat physical in nature.
As long as this log is written, there is no fear of sending exceptions in subsequent operations, because this log can continue the previous operation.
Moreover, the redoLog log is written cyclically in a fixed space, that is to say, when the space for storing the redoLog log is not enough, the latest log will overwrite the oldest log.

binLog

binLog is the log of the server layer. Whenever there is a data update operation, this log will be written.Record which data has the number of ids and what value has been modified. That is to say, the binLog log is logical in nature, and directly records the modification record of a certain data.
The binLog log is mainly used for data synchronization and data recovery in the master-slave mechanism. You can quickly know what the latest value of a certain piece of data should be through the binLog log.The Masert side sends binLog to each Slave side, so as to achieve the purpose of master-slave data consistency; and data recovery is to use the mysql binLog tool to recover data.
And this log is written additionally and will not overwrite the history.

undoLog

undoLog is the latest version of a piece of data every time it is modified, forming a version chain log of the data. When a transaction rollback operation occurs, the data can be restored directly through the specified version.
And it is very useful in transaction control, you can control the version that each transaction can see and thus control the isolation level of the transaction (only useful for read committed and non-repeatable reads)

Summary

redoLog is the log of the InnoDB engine, and is written cyclically, which will overwrite historical data.The log of the record is of a physical nature. It is a log that records all operations of the transaction in innoDB, including whether the record is written to the binLog. Only when the redoLog log records the commit transaction commit, the operation is completed.

The binLog log is the log of the server layer. It is logical in nature. It records what changes have been made to each piece of data. It is mainly used for master-slave replication and data recovery.

The undoLog log is the version chain control of the data. It is used in conjunction with MVCC. Each time the data is modified, a record will be generated, and the version that the transaction can see when querying is controlled.

原网站

版权声明
本文为[Mu Xiaotong]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/222/202208102231117854.html