当前位置:网站首页>Mvcc and bufferpool (VI)
Mvcc and bufferpool (VI)
2022-06-13 03:01:00 【summer_ forty-five】
Database notes
- Mysql Index bottom layer ( One )
- Explain Tools and index optimization ( Two )
- SQL stay MySQL Execution process in ( 3、 ... and )
- MySQL Index optimization ( Four )
- MySQL Transactions and locks ( 5、 ... and )
- MVCC and BufferPool( 6、 ... and )
MVCC
MVCC = undo + read-view
Service for isolation
Definition :
MVCC: Multi version concurrency control mechanism , stay Read committed and repeatable At the isolation level MVCC Mechanism
characteristic :
Not through locking , To achieve isolation between transactions
Realization principle
undo Log version chain
Definition :
undo Log version means A row of data is modified by multiple transactions in turn , **MySQL The data before each operation will be retained .** And use trx_id【 Business id】 and roll_pointer 【 rollback pointer 】 take undo Logs are concatenated , Form a historical version chain .

Special :
In case of deletion
- The latest data in the version chain will be copied
- And then trx_id Modify to delete trx_id
- In this article In the recorded header information delete_flag The flag bit is set to true
characteristic :
- For multiple transactions , There is only one log version chain
- Business id And rollback pointer Are hidden fields
Consistency view read-view
Definition :
When the transaction is on , Execute any query SQL, Generates the of the current transaction Consistency view
form :
- View array
- from All current uncommitted transactions id form
- Maximum transaction created id
{ [ Not submitted id1, Not submitted id2, Not submitted id3, Not submitted id4] max_id }
Be careful :
Business id stay == Execute the first DML When the sentence is , Generation ,== Not in begin/start transaction Generate .
Version chain alignment rules

readview:{ [200],300 }
The rules :
- Execute query statement
- The version chain is searched from top to bottom , If delete_flag == true, Don't return data . conversely :
- If trx_id Fall in the The green part (trx_id < min_id), Indicates that the version is generated by a committed transaction , so
- If trx_id Fall in the The red part (trx_id > max_id), Indicates that the version is generated by uncommitted transactions , invisible
- If trx_id Fall in the yellow (min_id < trx_id < max_id)
- If trx_id non-existent View array ([200]) in , Indicates that the version is generated by a committed transaction , so
- If trx_id There is View array ([200]) in , Indicates that the version is generated by uncommitted transactions , invisible
MVCC Read submitted
Realized MVCC Mechanism
characteristic :
- read-view The array changes dynamically with each query , Realized Sure Read committed transaction modifications Characteristics of
MVCC Repeatable
Realized MVCC Mechanism
characteristic :
- ==read-view After the array is generated, it is fixed ,== Achieved isolation .
BufferPool
BufferPool stay Engine layer from InnoDB Realization , be based on LRU Algorithm
Why design BufferPool?
Because no BufferPool, One request requires one disk Random, speaking, reading and writing I/O Update disk data , Poor performance ;
Although design BufferPool, There will be reading and writing to log files , but The log file is Sequential reading and writing I/O, Performance is better than random read / write I/O Much higher
One sql Implementation ( Service layer )
One DMLsql Implementation ( Engine layer )
- From disk ibd Load cached data in the file
- Write the old value to undo Log files 【 Version chain 、 Transaction commit failed, rollback 】
- to update BufferPool Data in
- Write redo Log cache
- Write redo Log files 【 Transaction submitted successfully , Recover in case of system downtime BufferPool data 】
- Write bin-log Log files 【 Transaction submitted successfully , Recover disk data in case of system downtime 】
- Write commit Mark to redo Log files 【 Make sure redo and bin-log Uniformity 】
- Background thread Random take BufferPool Modified data In pages Write to disk ibd file
边栏推荐
- Multiple knapsack problem
- Techniques for collecting stringgrid
- Ijkplayer source code --- decode
- Detailed explanation of handwritten numeral recognition based on support vector machine (Matlab GUI code, providing handwriting pad)
- A wechat app for shopping
- Summary of innovative ideas of transformer model in CV
- Ijkplayer source code - setting options
- MySQL index
- 专业的数据库管理软件:Valentina Studio Pro for Mac
- Scala implements workcount
猜你喜欢

Detailed installation tutorial of MATLAB r2019 B-mode ultrasound (complete installation files are attached)

Flutter reports an error type 'Int' is not a subtype of type 'string' wonderful experience

js 解构赋值

二叉树初始化代码

二叉樹初始化代碼

When the flutter runs the project, the gradle download fails, and the running gradle task 'assemblydebug' is always displayed

Keil去掉烦人的ST-Link更新提示
![[data analysis and visualization] key points of data mapping 7- over mapping](/img/ae/d4e251b37ec4857c99f738ca981092.jpg)
[data analysis and visualization] key points of data mapping 7- over mapping

OneNote User Guide (1)
![[data analysis and visualization] key points of data drawing 10- construction of legend](/img/34/cdb9695873b6d33e5119ab49247cb5.jpg)
[data analysis and visualization] key points of data drawing 10- construction of legend
随机推荐
Using binary heap to implement priority queue
OneNote使用指南(一)
Radio design and implementation in IVI system
JVM class loading (I)
Using linked list to find set union
Image classification system based on support vector machine (Matlab GUI interface version)
Ijkplayer source code -- Library loading and initialization
How to manage the IT R & D department?
[data analysis and visualization] key points of data drawing 4- problems of pie chart
Es and kibana deployment and setup
Svg filter effect use
Vant框架中关于IndexBar索引栏的CDN单页面引用,无法正常展示
[data analysis and visualization] key points of data drawing 6- too many data groups
遍历数组,删除某元素,直到删除为止
Prometheus install and register services
Ijkplayer source code - remuxing
JS deconstruction assignment
Linked list: adding numbers in the linked list
. Net compact Framework2.0 wince intelligent device development project experience sharing Net drag space advanced
OneNote User Guide (1)