MySql binary log, redo log notes, UndoLog

Briefly summarize the difference between binary logs and redo logs

Binary log (bin log): mysql database-level file is not recorded and show select statements, mainly used to restore the database and cluster configuration parameters sync_binlog = N (indicate how many times each write buffer on a disk synchronization), 1 It represents synchronously write disk (write-once disk cache that is synchronized once), the default is 0, write disk transaction commit (write to disk before the transaction commits only). There STATEMENT ROW MIXED three formats.

Redo log (redo log): Innodb level, used to record the transaction log Innodb storage engine, record changes in physical pages, the main thread synchronization disk once every 1s, used for data recovery, ensure the reliability of the transaction.

       innodb_flush_log_at_trx_commit used to control the log flushed to disk strategy, the default is 1, indicating that you must call fsync operation once the transaction commits. Set not to write redo log operation 0 for the transaction commits, the write operation is completed (1s write once), written redo log file 2 shows the transaction commits in the master thread, but does not call fsync

Note: When you write redo log, the first file system write buffer is written to ensure immediate disk, you need to call fsync function, synchronized to disk.

UndoLog: used to ensure transactional consistency, corresponding to the read submitted under MVCC and repeatable read level, multi-page version Undo, logical logs, can also be used to roll back the transaction, is stored in an internal database of the segment, referred to undo section, located in the shared table space.

Lock -> isolation

redo log -> prototype of persistence

undo log -> consistency

 

Innodb and myisam difference:

1 cache mechanism

2 Transaction Support

3 Lock achieve

Data storage 4

Guess you like

Origin blog.csdn.net/lr199966/article/details/90715566