MYSQL data placement

MYSQL data placement

redolog undolog
redolog is a log where the database is suddenly down. After restarting, the system automatically restores data based on the redolog

undolog is used to store historical versions ~ Why the rr rc isolation level can be read repeatedly is because mvcc multi-version concurrency control, mvcc relies on reading the historical version records of undolog to ensure visibility between transactions, and different versions are visible The performance is realized by the readview algorithm, and then explain the difference between rr rc isolation level mvcc, rc isolation level one query generates a readview, rr isolation level is a transaction to generate a readview, rr isolation level solves phantom reading by relying on mvcc and next-key (Gap lock)

Data Placement
Refer to the figure below first. The
Insert picture description here
data is first stored in the bufferpool (buffer), the bufferpool will be placed on the disk using the double write mechanism (double write), double write idb, ibdata (system table space, user table space). The disk timing passes through the check point (such as the bufferpool data occupancy reaches 75%, or the database is closed, etc.), and the bufferpool data is stored in the redolog buffer including redolog, dirty page data, dirty page index, undo log page, etc., and redolog is placed on the disk. The disk uses the force log atcommit mechanism. There is a sync parameter here. There are three values. 012. 0 represents real-time disk placement, regardless of whether the transaction is committed or not. The disk is placed every second; 1 represents the real-time disk placement to the disk after the transaction is committed; 2 represents the transaction commit After that, the order is placed asynchronously.

Guess you like

Origin blog.csdn.net/weixin_44969687/article/details/114455498