mysql redo log _mysql8.0 source code introduction of lock-free redo log
InnoDB, like most storage engines, uses WAL to write data. All data is first written to the redolog, and then flushed from the bufferpool to the data page or when the backup is restored. Restoring from redolog to bufferpoll, and then flushing dirty data pages, it is very important for WAL to convert random writes into sequential writes. Therefore, in the era of mechanical disks, the performance of sequential writes is far greater than that of random writes. Make full use of It improves the performance of the disk. But it also brings a problem, that is, any write operation must be locked for access to ensure that the next write operation can only be performed after the previous write operation is completed. This is also implemented in the early versions of InnoDB, but With the increase of the number of CPU cores, such frequent locking will not be able to exert multi-core performance, so in InnoDB8.0 it has been changed to lock-free implementation. This is the official introduction: https://mysqlserverteam.com/mysql-8-0 -new-lock-free-scalable-wal-design Version 5.6 implementation There are two operations that need to obtain the global mutex, log_sys_t::mutex, log_sys_t::flush_order_mutex Each user connection has a thread. Before writing data, log_sys_t::mutex must be obtained…