SlideShare a Scribd company logo
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
InnoDB MVCC Architecture
엑셈 | 권건우 상무
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
02. MySQL/InnoDB MVCC Architecture
01. MySQL/InnoDB Undo Architecture
Table of Agenda
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep InternalMVCC Architecture 발전
1970
1978
1981
E.F. Codd
PHILIP A. BERNSTEIN AND NATHAN GOODMAN
- the data independence objective
- the communicability objective
- the set-processing objective
Our approach is quite different. We regard an object that is modifiable as a
sequence of immutable versions. each version is the state of the object after
an update is made to the object.
Multiversion Concurrency Control
1984 The first shipping, commercial database software product featuring MVCC
was Digital's VAX Rdb/ELN. The second was InterBase, both of which are still
active, commercial products.
Jim Starkey
1986 Oracle version 6 에서 Rollback Segment 도입
Bob Miner
1999 Mikheev Vadim B.
PostgreSQL 6.5 에 MVCC 아키텍쳐를 도입함
David P. Reed
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep InternalMVCC Architecture의 두가지 접근법
• PostgreSQL, Firebird/Interbase, SQL Server 해당
• 데이터베이스에 다중 버전의 레코드를 저장
• 더 이상 필요하지 않을 때 모아둔 레코드를 버림
접근법 1
• Oracle, MySQL/InnoDB 해당
• 최신 버전의 데이터만 데이터베이스 내에 저장
• 언두를 이용하여 이전 버전의 데이터를 재구성
접근법 2
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL/InnoDB Undo Architecture
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep Internal
slot 0 4
slot 1 5
…
slot 1023
(1,5) Undo log
06d1 Rec001, A
T1.ibd space f9
Page
0
Page
1
Page
2
Page
3
Page
4
…
Page
64
MySQL/InnoDB Undo Architecture
ibdata1 space 0
Page
0
Page
1
Page
2
Page
3
Page
4
Page
5
…
(0,5) TRX_SYS Rseg 0 (0,6)
Rseg 1
…
Rseg 33 (1,3)
Rseg 127
undo001 space 1
Page
0
Page
1
Page
2
Page
3
Page
4
Page
5
… Page
8
ibtmp1
Rseg
1
Rseg
2
Rseg
3
Rseg
4
…
Rseg
32
Page (f9,3)
Rec001, A
(TRX_ID 0x778c,
Roll_PTR (5,06d1))
(1,3) Rollback Segment
System Tablespace
User Tablespace
Undo Tablespace
Temp Tablespace
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep Internal
slot 0 4
slot 1
…
slot 1023
(1,4) Undo log
0110 Rec001, A
(1,3) Rollback Segment
T1.ibd space f9
Page
0
Page
1
Page
2
Page
3
Page
4
…
Page
64
Page (f9,3)
Rec001, A
(TRX_ID 0x778b,
Roll_PTR (4,0110))
MySQL/InnoDB Undo Architecture (select 시)
0x7f0208608000
Data Page (f9,3)
Rec001, A
(TRX_ID 0x778b,
Roll_PTR (4,0110))
Insert A 후, Select * from t1;
TRX_SYS
max_trx_id = 0x778c
rw_trx_list->count = 0
mvcc->m_views->count = 1
Rseg 0 (0,6)
Rseg 1
…
Rseg 33 (1,3)
Rseg 127
ibdata1 space 0
Page
0
Page
1
…
Page
5
…
(0,5) TRX_SYS
undo001 space 1
Page
0
Page
1
Page
2
Page
3
Page
4
Page
5
… Page
8
Buffer Pool
User Tablespace
System Tablespace
Undo Tablespace
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep Internal
slot 0 4
slot 1 5
…
slot 1023
(1,5) Undo log
06d1 Rec001, A
(1,3) Rollback Segment
T1.ibd space f9
Page
0
Page
1
Page
2
Page
3
Page
4
…
Page
64
Page (f9,3)
Rec001, B
(TRX_ID 0x778c,
Roll_PTR (5,06d1))
MySQL/InnoDB Undo Architecture (update 시)
0x7f0208608000
Data Page (f9,3)
Rec001, B
(TRX_ID 0x778c,
Roll_PTR (5,06d1))
A를 B로 update (Update t1 Set c2 = B;)
TRX_SYS
max_trx_id = 0x778d
rw_trx_list->count = 0
mvcc->m_views->count = 1
Rseg 0 (0,6)
Rseg 1
…
Rseg 33 (1,3)
Rseg 127
ibdata1 space 0
Page
0
Page
1
…
Page
5
…
(0,5) TRX_SYS
undo001 space 1
Page
0
Page
1
Page
2
Page
3
Page
4
Page
5
… Page
8
0x7f0208608000
Data Page (f9,3)
Rec001, A
(TRX_ID 0x778b,
Roll_PTR (4,0110))
TRX_ID : 0x778c
addr=0x1b74a750
page_no=5
offset=0x6d1
Buffer Pool
User Tablespace
System Tablespace
Undo Tablespace
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL/InnoDB MVCC Architecture
1) MVCC
2) Readview
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep Internal
slot 0 4
slot 1 5
…
slot 1023
(1,5) Undo log
(1,3) Rollback Segment
MySQL/InnoDB MVCC Architecture
TRX_SYS
max_trx_id = 0x778d
rw_trx_list->count = 0
mvcc->m_views->count = 0
Rseg 0 (0,6)
Rseg 1
…
Rseg 33 (1,3)
Rseg 127
ibdata1 space 0
Page
0
Page
1
…
Page
5
…
(0,5) TRX_SYS
undo001 space 1
Page
0
Page
1
Page
2
Page
3
Page
4
Page
5
… Page
8
System Tablespace
Undo Tablespace
Readview Readview Readview Readview
TRX_STRUCTURE TRX_STRUCTURE TRX_STRUCTURE TRX_STRUCTURE
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep InternalMySQL/InnoDB MVCC Architecture
Rseg 0 (0,6)
Rseg 1
…
Rseg 33 (1,3)
Rseg 127
ibdata1 space 0
Page
0
Page
1
…
Page
5
…
System Tablespace
slot 0 4
slot 1
…
slot 1023
(1,4) Undo log(1,3) Rollback Segment
Undo Tablespace
Undo Page (1,4)
Rec001, A
(TRX_ID 0x778b)
1. 초기상태
Insert into t1
values(‘Rec001’,’A’);
Commit ;
Session 0
T1.ibd space f9
Page
0
…
Page
3
Page
4
…
Page
64
Page (f9,3)
Rec001, A
(TRX_ID 0x778b,
Roll_PTR (4,110))
Buffer Pool
User Tablespace
TRX_SYS
max_trx_id = 0x778c
rw_trx_list->count = 0
mvcc->m_views->count = 0
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep InternalMySQL/InnoDB MVCC Architecture
Session 0
Rseg 0 (0,6)
Rseg 1
…
Rseg 33 (1,3)
Rseg 127
ibdata1 space 0
Page
0
Page
1
…
Page
5
…
(0,5) TRX_SYS
System Tablespace
T1.ibd space f9
Page
0
…
Page
3
Page
4
…
Page
64
Page (f9,3)
Rec001, A
(TRX_ID 0x778b,
Roll_PTR (4,110))
Buffer Pool
User Tablespace
slot 0 4
slot 1
…
slot 1023
(1,3) Rollback Segment
Undo Tablespace
TRX_SYS
max_trx_id = 0x778c
rw_trx_list->count = 0
mvcc->m_views->count = 1
Select * from t1;
Rec001, A
Readview :
0x35dd108
Session 1
Readview : 0x35dd108
m_low_limit_no = 0x778c
m_low_limit_id = 0x778c
m_up_limit_id = 0x778c
m_ids->m_size = 0
0x7f0208608000
Data Page (f9,3)
Rec001, A
(TRX_ID 0x778b,
ROLL_PTR (4,110)
2. 세션1 Select
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep InternalMySQL/InnoDB MVCC Architecture
Rseg 0 (0,6)
Rseg 1
…
Rseg 33 (1,3)
Rseg 127
ibdata1 space 0
Page
0
Page
1
…
Page
5
…
(0,5) TRX_SYS
System Tablespace
T1.ibd space f9
Page
0
…
Page
3
Page
4
…
Page
64
Page (f9,3)
Rec001, B
(TRX_ID 0x778c)
Buffer Pool
User Tablespace
slot 0 4
slot 1 5
…
slot 1023
(1,3) Rollback Segment
Undo Tablespace
TRX_SYS
max_trx_id = 0x778d
rw_trx_list->count = 0
mvcc->m_views->count = 1
Readview : 0x35dd108
m_low_limit_no = 0x778c
m_low_limit_id = 0x778c
m_up_limit_id = 0x778c
m_ids->m_size = 0
TRX ID 0x778c
addr=0x1b74a750
0x7f02083b4000
Undo Page (1,5)
Rec001, A
(TRX_ID 0x778b)
0x7f0208608000
Data Page (f9,3)
Rec001, B
(TRX_ID 0x778c,
ROLL_PTR (5,6d1))
Undo Page (1,5)
(0x6d1)
Rec001, A
(TRX_ID 0x778b)
(1,5) Undo log
Update t1
Set c2 = B;
Session 0
Select * from t1;
Rec001, A
Readview :
0x35dd108
Session 1
3. 세션0 Update
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep InternalMySQL/InnoDB MVCC Architecture
Rseg 0 (0,6)
Rseg 1
…
Rseg 33 (1,3)
Rseg 127
ibdata1 space 0
Page
0
Page
1
…
Page
5
…
(0,5) TRX_SYS
System Tablespace
T1.ibd space f9
Page
0
…
Page
3
Page
4
…
Page
64
Page (f9,3)
Rec001, B
(TRX_ID 0x778c)
Buffer Pool
User Tablespace
slot 0 4
slot 1 5
…
slot 1023
(1,3) Rollback Segment
Undo Tablespace
TRX_SYS
max_trx_id = 0x778e
rw_trx_list->count = 0
mvcc->m_views->count = 2
m_views->start = 0x35dd068
Readview : 0x35dd068
m_low_limit_no = 0x778e
m_low_limit_id = 0x778e
m_up_limit_id = 0x778e
m_ids->m_size = 0
0x7f02083b4000
Undo Page (1,5)
Rec001, A
(TRX_ID 0x778b)
0x7f0208608000
Data Page (f9,3)
Rec001, B
(TRX_ID 0x778c,
ROLL_PTR (5,6d1))
Undo Page (1,5)
(0x6d1)
Rec001, A
(TRX_ID 0x778b)
(1,5) Undo log
Session 0
Select * from t1;
Rec001, A
Readview :
0x35dd108
Session 1
4. 세션2 Select
Select * from t1;
Rec001, B
Readview :
0x35dd068
Session 2
Readview : 0x35dd108
m_low_limit_no = 0x778c
m_low_limit_id = 0x778c
m_up_limit_id = 0x778c
m_ids->m_size = 0
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep InternalMySQL/InnoDB MVCC Architecture
Rseg 0 (0,6)
Rseg 1
…
Rseg 33 (1,3)
Rseg 127
ibdata1 space 0
Page
0
Page
1
…
Page
5
…
(0,5) TRX_SYS
System Tablespace
T1.ibd space f9
Page
0
…
Page
3
Page
4
…
Page
64
Page (f9,3)
Rec001, C
(TRX_ID 0x778e)
Buffer Pool
User Tablespace
slot 0 4
slot 1 5
…
slot 1023
(1,3) Rollback Segment
Undo Tablespace
TRX_SYS
max_trx_id = 0x778e
rw_trx_list->count = 0
mvcc->m_views->count = 2
m_views->start = 0x35dd068
Readview : 0x35dd068
m_low_limit_no = 0x778e
m_low_limit_id = 0x778e
m_up_limit_id = 0x778e
m_ids->m_size = 0
(1,5) Undo log
Update t1
set c2 = C;
Session 0
Select * from t1;
Rec001, A
Readview :
0x35dd108
Session 1
5. 세션0 Update
Select * from t1;
Rec001, B
Readview :
0x35dd068
Session 2
Readview : 0x35dd108
m_low_limit_no = 0x778c
m_low_limit_id = 0x778c
m_up_limit_id = 0x778c
m_ids->m_size = 0
TRX ID 0x778e
addr=0x1b74a750
0x7f02083b4000
Undo Page (1,5)
(0x6d1)
Rec001, A
(TRX_ID 0x778b)
0x7f02083b4000
Undo Page (1,5)
(0x7be)
Rec001, B
(TRX_ID 0x778c
ROLL_PTR (5,6d1))
0x7f0208608000
Data Page (f9,3)
Rec001, B
(TRX_ID 0x778c,
ROLL_PTR (5,6d1))
Undo Page (1,5)
0x6d1
Rec001, A
(TRX_ID 0x778b)
Undo Page (1,5)
(0x7be)
Rec001, B
(TRX_ID 0x778c
ROLL_PTR (5,6d1))
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep InternalMySQL/InnoDB MVCC Architecture
Rseg 0 (0,6)
Rseg 1
…
Rseg 33 (1,3)
Rseg 127
ibdata1 space 0
Page
0
Page
1
…
Page
5
…
(0,5) TRX_SYS
System Tablespace
T1.ibd space f9
Page
0
…
Page
3
Page
4
…
Page
64
Page (f9,3)
Rec001, C
(TRX_ID 0x778e)
Buffer Pool
User Tablespace
slot 0 4
slot 1 5
…
slot 1023
(1,3) Rollback Segment
Undo Tablespace
TRX_SYS
max_trx_id = 0x7790
rw_trx_list->count = 0
mvcc->m_views->count = 3
m_views->start = 0x35ddfc8
Readview : 0x35dcfc8
m_low_limit_no = 0x7790
m_low_limit_id = 0x7790
m_up_limit_id = 0x7790
m_ids->m_size = 0
(1,5) Undo log
Session 0
Select * from t1;
Rec001, A
Readview :
0x35dd108
Session 1
6. 세션3 Select
Select * from t1;
Rec001, B
Readview :
0x35dd068
Session 2
Readview : 0x35dd068
m_low_limit_no = 0x778e
m_low_limit_id = 0x778e
m_up_limit_id = 0x778e
m_ids->m_size = 0
0x7f02083b4000
Undo Page (1,5)
(0x6d1)
Rec001, A
(TRX_ID 0x778b)
0x7f02083b4000
Undo Page (1,5)
(0x7be)
Rec001, B
(TRX_ID 0x778c
ROLL_PTR (5,6d1))
0x7f0208608000
Data Page (f9,3)
Rec001, C
(TRX_ID 0x778e,
ROLL_PTR (5,7be))
Undo Page (1,5)
0x6d1
Rec001, A
(TRX_ID 0x778b)
Undo Page (1,5)
(0x7be)
Rec001, B
(TRX_ID 0x778c
ROLL_PTR (5,6d1))
Select * from t1;
Rec001, C
Readview :
0x35ddfc8
Session 2
Readview : 0x35dd108
m_low_limit_no = 0x778c
m_low_limit_id = 0x778c
m_up_limit_id = 0x778c
m_ids->m_size = 0
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep InternalReadview
정의 및 목적
• 트랜잭션이 발생하면, COMMIT 시점이 아닌 트랜잭션 시작 시점의 TRX_ID 가 저장됨
• 쿼리 시작시점의 액티브 트랜잭션들의 집합 (COMMIT/ROLLBACK 하지 않은 상태)
• MVCC 구현에 반드시 필요
Component Description
low_limit_no
- 해당 값을 Purge thread가 참조하여 불필요한 Undo log들을 처리하는 purge 작업에 사용된다.
- low_limit_no = Readview 생성시 trx_sys의 max_trx_id값
low_limit_id
- low_limit_id보다 크거나 같은 TRX_ID (trx_id >= low_limit_id) 는 해당 readview에서 조회 안 됨
- low_limit_id = Readview 생성시 trx_sys의 max_trx_id값
up_limit_id
- up_limit_id(trx_id < up_limit_id) 보다 작은 트랜잭션
TRX_ID 는 해당 readview에서 모두 조회됨
- up_limit_id = readview 생성시, active 트랜잭션 중 가장 작은 TRX_ID
trx_ids[] - 모든 액티브 트랜잭션 id로 구성된 그룹
view_list - Readview list (doubly linked list)
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep InternalReadview
New TRX Structure
mutex
max_trx_id = 0x98fd
rw_trx_list
count = 3
start = 0x4fe4fae0
mvcc->m_views
count = 3
start = 0x25b9f08
…
trx_sys Trx linked list
trx id = 0x98fc
update_undo :
page_no = 6
offset = 0x86c
trx_list
prev = 0x00
next = 0x4fe4fe70
…
trx id = 0x98fb
update_undo :
page_no = 7
offset = 0x370
trx_list
prev = 0x4fe4fae0
next = 0x4fe4f750
…
trx id = 0x98f8
update_undo :
page_no = 5
offset = 0x2c4
trx_list
prev = 0x4fe4fe70
next = 0x00
…
trx0 0x4fe4fae0 trx1 0x4fe4fe70 trx2 0x4fe4f750
New Readview
Readview linked list
m_low_limit_no = 0x98fd
m_low_limit_id = 0x98fd
m_up_limit_id = 0x98f8
m_view_list
prev = 0x0
next = 0x25b9fa8
m_ids->m_size = 3
m_ids[0] = 0x98f8
m_ids[1] = 0x98fb
m_ids[2] = 0x98fc
readview0 0x25b9f08
m_low_limit_no = 0x98fc
m_low_limit_id = 0x98fc
m_up_limit_id = 0x98f8
m_view_list
prev = 0x25b9f08
next = 0x25ba048
m_ids->m_size = 2
m_ids[0] = 0x98f8
m_ids[1] = 0x98fb
readview1 0x25b9fa8
m_low_limit_no = 0x98fb
m_low_limit_id = 0x98fb
m_up_limit_id = 0x98f8
m_view_list
prev = 0x25b9fa8
next = 0x0
m_ids->m_size = 1
m_ids[0] = 0x98f8
readview2 0x25ba048
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep InternalReadview
1. t1 Table 생성
create table t1 (id int primary key, comment
char(50), filler char(2)) engine = innodb;
2. Secondary index 생성
create index test_idx on test(comment);
T1.ibdspace173
Page
0
Page
1
Page
2
Page
3
Page
4
Page
5
…
UNDO001space1
Page
0
Page
1
Page
2
Page
3
Page
4
Page
5
…
Secondary Index
source : InnoDBTransaction/Lock/Multi-version analysis, 网易杭研-何登成
Clustering Index
Page 4
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep InternalReadview
3. TRX_ID가 0x96f6 일때, t1에 1건 Insert
insert into t.test values (65, 'aaa',' ') ;
T1.ibdspace173
Page
0
Page
1
Page
2
Page
3
Page
4
Page
5
…
Deleted: 0
65
DB_TRX_ID (0x96f6)
DB_ROLL_PTR (4,110)
aaa
Deleted: 0
aaa
PK: 65
UNDO001space1
Page
0
Page
1
Page
2
Page
3
Page
4
Page
5
…
Insert Undo
aaa
PK: 65
source : InnoDBTransaction/Lock/Multi-version analysis, 网易杭研-何登成
Secondary Index
Clustering Index
Page 4
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep InternalReadview
4. Primary key 업데이트
update t.test set id = 67 where id = 65 ;
T1.ibdspace173
Page
0
Page
1
Page
2
Page
3
Page
4
Page
5
…
Deleted: 1
65
DB_TRX_ID (0x96fc)
DB_ROLL_PTR (7,110)
aaa
Deleted: 1
aaa
PK: 65
UNDO001space1
Page
0
Page
1
Page
2
Page
3
Page
4
…
Page
7
Update Undo
aaa
PK: 65
source : InnoDBTransaction/Lock/Multi-version analysis, 网易杭研-何登成
• 새로운 레코드 (67, aaa)가 추가됨
(Insert 발생하는 것처럼 Insert Undo에 저장)
• 이전 레코드 (65, aaa)는 삭제 표시됨 (삭제 flag, trx_id, roll_ptr를
설정하고, before-image를 Update Undo에 저장)
• Secondary Index 페이지에서도 레코드 (aaa, 65) 는 삭제 설정하고
레코드 (aaa,67)가 추가됨
Deleted: 0
67
DB_TRX_ID (0x96fc)
DB_ROLL_PTR (4,11d)
aaa
Deleted: 0
aaa
PK: 67
Insert Undo
aaa
PK: 67
Secondary Index
Clustering Index
Page 4 Page 7
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep InternalReadview
5. Secondary key 업데이트
update t.test set comment = 'ccc' where id = 67 ;
T1.ibdspace173
Page
0
Page
1
Page
2
Page
3
Page
4
Page
5
…
Deleted: 1
65
DB_TRX_ID (0x96fc)
DB_ROLL_PTR (7,110)
aaa
Deleted: 1
aaa
PK: 65
UNDO001space1
Page
0
Page
1
Page
2
Page
3
Page
4
…
Page
7
Update Undo
aaa
PK: 65
source : InnoDBTransaction/Lock/Multi-version analysis, 网易杭研-何登成
• 레코드 (67,aaa)를 레코드 (67,ccc)로 변경하고, before-image를
Update Undo에 저장
• Secondary Index 페이지에서도 레코드 (aaa,67)는 삭제 설정되고,
레코드 (ccc,67)가 추가됨.
Deleted: 0
67
DB_TRX_ID (0x9700)
DB_ROLL_PTR (7,224)
ccc
Deleted: 1
aaa
PK: 67
Update Undo
aaa
PK: 67
Deleted: 0
ccc
PK: 67
Secondary Index
Clustering Index
Page 7
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep InternalReadview
Session 0 (DML)
Session 1 (DML)
Session 2 (DML)
Session 3 (Read)
Session 4 (Read)
Session 5 (Read)
UPDATE
(67, ‘ccc’)
INSERT
(65, ‘aaa’)
UPDATE
(67, ‘aaa’)
0x96f5
0x96f6
0x96fb 0x96fc 0x97000x96ff 0x97060x96fd 0x97090x9705
READVIEW 0 0x25c0ee8
UP:0x96f5 ~ LOW:0x96fd
Trx:0x96f5, 0x96fb, 0x96fc
Select * from test (65,aaa)
READVIEW 1 0x25c0e48
UP:0x96fb ~ LOW:0x9705
Trx:0x96fb, 0x96ff, 0x9700
Select * from test (67,aaa) READVIEW 2 0x25c0da8
UP:0x9706~ LOW:0x9709
Trx:0x9706
Select * from test (67,ccc)
TX 0x96f5
TX 0x96fb
TX 0x96fc
TX 0x9700
TX 0x96ff
TX 0x9706
MySQL Deep Internal
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
MySQL Deep Internal
source : InnoDBTransaction/Lock/Multi-version analysis, 网易杭研-何登成
Readview
select * from t1;
case up_limit_id low_limit_id trx_ids [ ] query result
Readview0 Primary Key 변경 0x96f5 0x96fd 0x96f5, 0x96fb, 0x96fc (65, aaa)
Readview1 Secondary Key 변경 0x96fb 0x9705 0x96fb, 0x96ff, 0x9700 (67, aaa)
Readview2
해당 테이블에
트랜잭션이 없을 경우
0x9706 0x9709 0x9706 (67, ccc)
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
NAVER http://cafe.naver.com/playexem
ITPUB (中) http://blog.itpub.net/31135309/
Wordpress https://playexem.wordpress.com/
Slideshare http://www.slideshare.net/playexem
교육 문의 edu@ex-em.com
EXEM Research & Contents Team
Youtube https://www.youtube.com/channel/UC5wKR
_-A0eL_Pn_EMzoauJg
Tudou (中) http://www.tudou.com/home/maxgauge/
© Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved.
감사합니다

More Related Content

What's hot

How to Take Advantage of Optimizer Improvements in MySQL 8.0
How to Take Advantage of Optimizer Improvements in MySQL 8.0How to Take Advantage of Optimizer Improvements in MySQL 8.0
How to Take Advantage of Optimizer Improvements in MySQL 8.0Norvald Ryeng
 
Mvcc (oracle, innodb, postgres)
Mvcc (oracle, innodb, postgres)Mvcc (oracle, innodb, postgres)
Mvcc (oracle, innodb, postgres)frogd
 
MySQL_SQL_Tunning_v0.1.3.docx
MySQL_SQL_Tunning_v0.1.3.docxMySQL_SQL_Tunning_v0.1.3.docx
MySQL_SQL_Tunning_v0.1.3.docxNeoClova
 
MySQL Timeout Variables Explained
MySQL Timeout Variables Explained MySQL Timeout Variables Explained
MySQL Timeout Variables Explained Mydbops
 
Dd and atomic ddl pl17 dublin
Dd and atomic ddl pl17 dublinDd and atomic ddl pl17 dublin
Dd and atomic ddl pl17 dublinStåle Deraas
 
MySQL innoDB split and merge pages
MySQL innoDB split and merge pagesMySQL innoDB split and merge pages
MySQL innoDB split and merge pagesMarco Tusa
 
Evolution of MySQL Parallel Replication
Evolution of MySQL Parallel Replication Evolution of MySQL Parallel Replication
Evolution of MySQL Parallel Replication Mydbops
 
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialJean-François Gagné
 
MySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestMySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestI Goo Lee
 
Mvcc in postgreSQL 권건우
Mvcc in postgreSQL 권건우Mvcc in postgreSQL 권건우
Mvcc in postgreSQL 권건우PgDay.Seoul
 
The InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLThe InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLMorgan Tocker
 
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...Jean-François Gagné
 
The MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer TraceThe MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer Traceoysteing
 
Linux and H/W optimizations for MySQL
Linux and H/W optimizations for MySQLLinux and H/W optimizations for MySQL
Linux and H/W optimizations for MySQLYoshinori Matsunobu
 
Solving PostgreSQL wicked problems
Solving PostgreSQL wicked problemsSolving PostgreSQL wicked problems
Solving PostgreSQL wicked problemsAlexander Korotkov
 
M|18 Deep Dive: InnoDB Transactions and Write Paths
M|18 Deep Dive: InnoDB Transactions and Write PathsM|18 Deep Dive: InnoDB Transactions and Write Paths
M|18 Deep Dive: InnoDB Transactions and Write PathsMariaDB plc
 
PostgreSQL Performance Tuning
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuningelliando dias
 
What is new in PostgreSQL 14?
What is new in PostgreSQL 14?What is new in PostgreSQL 14?
What is new in PostgreSQL 14?Mydbops
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxNeoClova
 

What's hot (20)

How to Take Advantage of Optimizer Improvements in MySQL 8.0
How to Take Advantage of Optimizer Improvements in MySQL 8.0How to Take Advantage of Optimizer Improvements in MySQL 8.0
How to Take Advantage of Optimizer Improvements in MySQL 8.0
 
Mvcc (oracle, innodb, postgres)
Mvcc (oracle, innodb, postgres)Mvcc (oracle, innodb, postgres)
Mvcc (oracle, innodb, postgres)
 
MySQL_SQL_Tunning_v0.1.3.docx
MySQL_SQL_Tunning_v0.1.3.docxMySQL_SQL_Tunning_v0.1.3.docx
MySQL_SQL_Tunning_v0.1.3.docx
 
MySQL Timeout Variables Explained
MySQL Timeout Variables Explained MySQL Timeout Variables Explained
MySQL Timeout Variables Explained
 
Dd and atomic ddl pl17 dublin
Dd and atomic ddl pl17 dublinDd and atomic ddl pl17 dublin
Dd and atomic ddl pl17 dublin
 
MySQL innoDB split and merge pages
MySQL innoDB split and merge pagesMySQL innoDB split and merge pages
MySQL innoDB split and merge pages
 
Evolution of MySQL Parallel Replication
Evolution of MySQL Parallel Replication Evolution of MySQL Parallel Replication
Evolution of MySQL Parallel Replication
 
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication Tutorial
 
MySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestMySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software Test
 
Mvcc in postgreSQL 권건우
Mvcc in postgreSQL 권건우Mvcc in postgreSQL 권건우
Mvcc in postgreSQL 권건우
 
The InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQLThe InnoDB Storage Engine for MySQL
The InnoDB Storage Engine for MySQL
 
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
 
The MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer TraceThe MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer Trace
 
PostgreSQL replication
PostgreSQL replicationPostgreSQL replication
PostgreSQL replication
 
Linux and H/W optimizations for MySQL
Linux and H/W optimizations for MySQLLinux and H/W optimizations for MySQL
Linux and H/W optimizations for MySQL
 
Solving PostgreSQL wicked problems
Solving PostgreSQL wicked problemsSolving PostgreSQL wicked problems
Solving PostgreSQL wicked problems
 
M|18 Deep Dive: InnoDB Transactions and Write Paths
M|18 Deep Dive: InnoDB Transactions and Write PathsM|18 Deep Dive: InnoDB Transactions and Write Paths
M|18 Deep Dive: InnoDB Transactions and Write Paths
 
PostgreSQL Performance Tuning
PostgreSQL Performance TuningPostgreSQL Performance Tuning
PostgreSQL Performance Tuning
 
What is new in PostgreSQL 14?
What is new in PostgreSQL 14?What is new in PostgreSQL 14?
What is new in PostgreSQL 14?
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptx
 

Similar to InnoDB MVCC Architecture (by 권건우)

New Zephyr features: LWM2M / FOTA Framework - SFO17-113
New Zephyr features: LWM2M / FOTA Framework - SFO17-113New Zephyr features: LWM2M / FOTA Framework - SFO17-113
New Zephyr features: LWM2M / FOTA Framework - SFO17-113Linaro
 
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오PgDay.Seoul
 
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsReverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsAsuka Nakajima
 
HandlerSocket plugin for MySQL (English)
HandlerSocket plugin for MySQL (English)HandlerSocket plugin for MySQL (English)
HandlerSocket plugin for MySQL (English)akirahiguchi
 
PE102 - a Windows executable format overview (booklet V1)
PE102 - a Windows executable format overview (booklet V1)PE102 - a Windows executable format overview (booklet V1)
PE102 - a Windows executable format overview (booklet V1)Ange Albertini
 
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)Dave Stokes
 
Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...
Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...
Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...Hsien-Hsin Sean Lee, Ph.D.
 
The forgotten art of assembly
The forgotten art of assemblyThe forgotten art of assembly
The forgotten art of assemblyMarian Marinov
 
Cisco IOS shellcode: All-in-one
Cisco IOS shellcode: All-in-oneCisco IOS shellcode: All-in-one
Cisco IOS shellcode: All-in-oneDefconRussia
 
Introduction to Reactive Extensions (Rx)
Introduction to Reactive Extensions (Rx)Introduction to Reactive Extensions (Rx)
Introduction to Reactive Extensions (Rx)Tamir Dresher
 
r2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCyr2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCyRay Song
 
MySQL Goes to 8! FOSDEM 2020 Database Track, January 2nd, 2020
MySQL Goes to 8!  FOSDEM 2020 Database Track, January 2nd, 2020MySQL Goes to 8!  FOSDEM 2020 Database Track, January 2nd, 2020
MySQL Goes to 8! FOSDEM 2020 Database Track, January 2nd, 2020Geir Høydalsvik
 
C++ and Assembly: Debugging and Reverse Engineering
C++ and Assembly: Debugging and Reverse EngineeringC++ and Assembly: Debugging and Reverse Engineering
C++ and Assembly: Debugging and Reverse Engineeringcorehard_by
 
2012 09 MariaDB Boston Meetup - MariaDB 是 Mysql 的替代者吗
2012 09 MariaDB Boston Meetup - MariaDB 是 Mysql 的替代者吗2012 09 MariaDB Boston Meetup - MariaDB 是 Mysql 的替代者吗
2012 09 MariaDB Boston Meetup - MariaDB 是 Mysql 的替代者吗YUCHENG HU
 
Yevhen Tatarynov "From POC to High-Performance .NET applications"
Yevhen Tatarynov "From POC to High-Performance .NET applications"Yevhen Tatarynov "From POC to High-Performance .NET applications"
Yevhen Tatarynov "From POC to High-Performance .NET applications"LogeekNightUkraine
 
Smu mscit sem 1 fall 2016 assignments
Smu mscit sem 1 fall 2016 assignmentsSmu mscit sem 1 fall 2016 assignments
Smu mscit sem 1 fall 2016 assignmentssolved_assignments
 
Vectorization on x86: all you need to know
Vectorization on x86: all you need to knowVectorization on x86: all you need to know
Vectorization on x86: all you need to knowRoberto Agostino Vitillo
 

Similar to InnoDB MVCC Architecture (by 권건우) (20)

New Zephyr features: LWM2M / FOTA Framework - SFO17-113
New Zephyr features: LWM2M / FOTA Framework - SFO17-113New Zephyr features: LWM2M / FOTA Framework - SFO17-113
New Zephyr features: LWM2M / FOTA Framework - SFO17-113
 
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오
[Pgday.Seoul 2017] 3. PostgreSQL WAL Buffers, Clog Buffers Deep Dive - 이근오
 
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsReverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
 
HandlerSocket plugin for MySQL (English)
HandlerSocket plugin for MySQL (English)HandlerSocket plugin for MySQL (English)
HandlerSocket plugin for MySQL (English)
 
PE102 - a Windows executable format overview (booklet V1)
PE102 - a Windows executable format overview (booklet V1)PE102 - a Windows executable format overview (booklet V1)
PE102 - a Windows executable format overview (booklet V1)
 
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
 
Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...
Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...
Lec18 Intro to Computer Engineering by Hsien-Hsin Sean Lee Georgia Tech -- In...
 
The forgotten art of assembly
The forgotten art of assemblyThe forgotten art of assembly
The forgotten art of assembly
 
Cisco IOS shellcode: All-in-one
Cisco IOS shellcode: All-in-oneCisco IOS shellcode: All-in-one
Cisco IOS shellcode: All-in-one
 
Introduction to Reactive Extensions (Rx)
Introduction to Reactive Extensions (Rx)Introduction to Reactive Extensions (Rx)
Introduction to Reactive Extensions (Rx)
 
MySQL8.0 in COSCUP2017
MySQL8.0 in COSCUP2017MySQL8.0 in COSCUP2017
MySQL8.0 in COSCUP2017
 
r2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCyr2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCy
 
MySQL Goes to 8! FOSDEM 2020 Database Track, January 2nd, 2020
MySQL Goes to 8!  FOSDEM 2020 Database Track, January 2nd, 2020MySQL Goes to 8!  FOSDEM 2020 Database Track, January 2nd, 2020
MySQL Goes to 8! FOSDEM 2020 Database Track, January 2nd, 2020
 
Cisc mc68000
Cisc mc68000Cisc mc68000
Cisc mc68000
 
microprocessors
microprocessorsmicroprocessors
microprocessors
 
C++ and Assembly: Debugging and Reverse Engineering
C++ and Assembly: Debugging and Reverse EngineeringC++ and Assembly: Debugging and Reverse Engineering
C++ and Assembly: Debugging and Reverse Engineering
 
2012 09 MariaDB Boston Meetup - MariaDB 是 Mysql 的替代者吗
2012 09 MariaDB Boston Meetup - MariaDB 是 Mysql 的替代者吗2012 09 MariaDB Boston Meetup - MariaDB 是 Mysql 的替代者吗
2012 09 MariaDB Boston Meetup - MariaDB 是 Mysql 的替代者吗
 
Yevhen Tatarynov "From POC to High-Performance .NET applications"
Yevhen Tatarynov "From POC to High-Performance .NET applications"Yevhen Tatarynov "From POC to High-Performance .NET applications"
Yevhen Tatarynov "From POC to High-Performance .NET applications"
 
Smu mscit sem 1 fall 2016 assignments
Smu mscit sem 1 fall 2016 assignmentsSmu mscit sem 1 fall 2016 assignments
Smu mscit sem 1 fall 2016 assignments
 
Vectorization on x86: all you need to know
Vectorization on x86: all you need to knowVectorization on x86: all you need to know
Vectorization on x86: all you need to know
 

Recently uploaded

"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...Product School
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationZilliz
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsExpeed Software
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomCzechDreamin
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIES VE
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...Product School
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlPeter Udo Diehl
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1DianaGray10
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka DoktorováCzechDreamin
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...CzechDreamin
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekCzechDreamin
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backElena Simperl
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Product School
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaCzechDreamin
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Product School
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024Stephanie Beckett
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Thierry Lestable
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...CzechDreamin
 

Recently uploaded (20)

"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 

InnoDB MVCC Architecture (by 권건우)

  • 1. © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. InnoDB MVCC Architecture 엑셈 | 권건우 상무
  • 2. © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. 02. MySQL/InnoDB MVCC Architecture 01. MySQL/InnoDB Undo Architecture Table of Agenda
  • 3. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep InternalMVCC Architecture 발전 1970 1978 1981 E.F. Codd PHILIP A. BERNSTEIN AND NATHAN GOODMAN - the data independence objective - the communicability objective - the set-processing objective Our approach is quite different. We regard an object that is modifiable as a sequence of immutable versions. each version is the state of the object after an update is made to the object. Multiversion Concurrency Control 1984 The first shipping, commercial database software product featuring MVCC was Digital's VAX Rdb/ELN. The second was InterBase, both of which are still active, commercial products. Jim Starkey 1986 Oracle version 6 에서 Rollback Segment 도입 Bob Miner 1999 Mikheev Vadim B. PostgreSQL 6.5 에 MVCC 아키텍쳐를 도입함 David P. Reed
  • 4. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep InternalMVCC Architecture의 두가지 접근법 • PostgreSQL, Firebird/Interbase, SQL Server 해당 • 데이터베이스에 다중 버전의 레코드를 저장 • 더 이상 필요하지 않을 때 모아둔 레코드를 버림 접근법 1 • Oracle, MySQL/InnoDB 해당 • 최신 버전의 데이터만 데이터베이스 내에 저장 • 언두를 이용하여 이전 버전의 데이터를 재구성 접근법 2
  • 5. © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL/InnoDB Undo Architecture
  • 6. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep Internal slot 0 4 slot 1 5 … slot 1023 (1,5) Undo log 06d1 Rec001, A T1.ibd space f9 Page 0 Page 1 Page 2 Page 3 Page 4 … Page 64 MySQL/InnoDB Undo Architecture ibdata1 space 0 Page 0 Page 1 Page 2 Page 3 Page 4 Page 5 … (0,5) TRX_SYS Rseg 0 (0,6) Rseg 1 … Rseg 33 (1,3) Rseg 127 undo001 space 1 Page 0 Page 1 Page 2 Page 3 Page 4 Page 5 … Page 8 ibtmp1 Rseg 1 Rseg 2 Rseg 3 Rseg 4 … Rseg 32 Page (f9,3) Rec001, A (TRX_ID 0x778c, Roll_PTR (5,06d1)) (1,3) Rollback Segment System Tablespace User Tablespace Undo Tablespace Temp Tablespace
  • 7. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep Internal slot 0 4 slot 1 … slot 1023 (1,4) Undo log 0110 Rec001, A (1,3) Rollback Segment T1.ibd space f9 Page 0 Page 1 Page 2 Page 3 Page 4 … Page 64 Page (f9,3) Rec001, A (TRX_ID 0x778b, Roll_PTR (4,0110)) MySQL/InnoDB Undo Architecture (select 시) 0x7f0208608000 Data Page (f9,3) Rec001, A (TRX_ID 0x778b, Roll_PTR (4,0110)) Insert A 후, Select * from t1; TRX_SYS max_trx_id = 0x778c rw_trx_list->count = 0 mvcc->m_views->count = 1 Rseg 0 (0,6) Rseg 1 … Rseg 33 (1,3) Rseg 127 ibdata1 space 0 Page 0 Page 1 … Page 5 … (0,5) TRX_SYS undo001 space 1 Page 0 Page 1 Page 2 Page 3 Page 4 Page 5 … Page 8 Buffer Pool User Tablespace System Tablespace Undo Tablespace
  • 8. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep Internal slot 0 4 slot 1 5 … slot 1023 (1,5) Undo log 06d1 Rec001, A (1,3) Rollback Segment T1.ibd space f9 Page 0 Page 1 Page 2 Page 3 Page 4 … Page 64 Page (f9,3) Rec001, B (TRX_ID 0x778c, Roll_PTR (5,06d1)) MySQL/InnoDB Undo Architecture (update 시) 0x7f0208608000 Data Page (f9,3) Rec001, B (TRX_ID 0x778c, Roll_PTR (5,06d1)) A를 B로 update (Update t1 Set c2 = B;) TRX_SYS max_trx_id = 0x778d rw_trx_list->count = 0 mvcc->m_views->count = 1 Rseg 0 (0,6) Rseg 1 … Rseg 33 (1,3) Rseg 127 ibdata1 space 0 Page 0 Page 1 … Page 5 … (0,5) TRX_SYS undo001 space 1 Page 0 Page 1 Page 2 Page 3 Page 4 Page 5 … Page 8 0x7f0208608000 Data Page (f9,3) Rec001, A (TRX_ID 0x778b, Roll_PTR (4,0110)) TRX_ID : 0x778c addr=0x1b74a750 page_no=5 offset=0x6d1 Buffer Pool User Tablespace System Tablespace Undo Tablespace
  • 9. © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL/InnoDB MVCC Architecture 1) MVCC 2) Readview
  • 10. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep Internal slot 0 4 slot 1 5 … slot 1023 (1,5) Undo log (1,3) Rollback Segment MySQL/InnoDB MVCC Architecture TRX_SYS max_trx_id = 0x778d rw_trx_list->count = 0 mvcc->m_views->count = 0 Rseg 0 (0,6) Rseg 1 … Rseg 33 (1,3) Rseg 127 ibdata1 space 0 Page 0 Page 1 … Page 5 … (0,5) TRX_SYS undo001 space 1 Page 0 Page 1 Page 2 Page 3 Page 4 Page 5 … Page 8 System Tablespace Undo Tablespace Readview Readview Readview Readview TRX_STRUCTURE TRX_STRUCTURE TRX_STRUCTURE TRX_STRUCTURE
  • 11. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep InternalMySQL/InnoDB MVCC Architecture Rseg 0 (0,6) Rseg 1 … Rseg 33 (1,3) Rseg 127 ibdata1 space 0 Page 0 Page 1 … Page 5 … System Tablespace slot 0 4 slot 1 … slot 1023 (1,4) Undo log(1,3) Rollback Segment Undo Tablespace Undo Page (1,4) Rec001, A (TRX_ID 0x778b) 1. 초기상태 Insert into t1 values(‘Rec001’,’A’); Commit ; Session 0 T1.ibd space f9 Page 0 … Page 3 Page 4 … Page 64 Page (f9,3) Rec001, A (TRX_ID 0x778b, Roll_PTR (4,110)) Buffer Pool User Tablespace TRX_SYS max_trx_id = 0x778c rw_trx_list->count = 0 mvcc->m_views->count = 0
  • 12. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep InternalMySQL/InnoDB MVCC Architecture Session 0 Rseg 0 (0,6) Rseg 1 … Rseg 33 (1,3) Rseg 127 ibdata1 space 0 Page 0 Page 1 … Page 5 … (0,5) TRX_SYS System Tablespace T1.ibd space f9 Page 0 … Page 3 Page 4 … Page 64 Page (f9,3) Rec001, A (TRX_ID 0x778b, Roll_PTR (4,110)) Buffer Pool User Tablespace slot 0 4 slot 1 … slot 1023 (1,3) Rollback Segment Undo Tablespace TRX_SYS max_trx_id = 0x778c rw_trx_list->count = 0 mvcc->m_views->count = 1 Select * from t1; Rec001, A Readview : 0x35dd108 Session 1 Readview : 0x35dd108 m_low_limit_no = 0x778c m_low_limit_id = 0x778c m_up_limit_id = 0x778c m_ids->m_size = 0 0x7f0208608000 Data Page (f9,3) Rec001, A (TRX_ID 0x778b, ROLL_PTR (4,110) 2. 세션1 Select
  • 13. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep InternalMySQL/InnoDB MVCC Architecture Rseg 0 (0,6) Rseg 1 … Rseg 33 (1,3) Rseg 127 ibdata1 space 0 Page 0 Page 1 … Page 5 … (0,5) TRX_SYS System Tablespace T1.ibd space f9 Page 0 … Page 3 Page 4 … Page 64 Page (f9,3) Rec001, B (TRX_ID 0x778c) Buffer Pool User Tablespace slot 0 4 slot 1 5 … slot 1023 (1,3) Rollback Segment Undo Tablespace TRX_SYS max_trx_id = 0x778d rw_trx_list->count = 0 mvcc->m_views->count = 1 Readview : 0x35dd108 m_low_limit_no = 0x778c m_low_limit_id = 0x778c m_up_limit_id = 0x778c m_ids->m_size = 0 TRX ID 0x778c addr=0x1b74a750 0x7f02083b4000 Undo Page (1,5) Rec001, A (TRX_ID 0x778b) 0x7f0208608000 Data Page (f9,3) Rec001, B (TRX_ID 0x778c, ROLL_PTR (5,6d1)) Undo Page (1,5) (0x6d1) Rec001, A (TRX_ID 0x778b) (1,5) Undo log Update t1 Set c2 = B; Session 0 Select * from t1; Rec001, A Readview : 0x35dd108 Session 1 3. 세션0 Update
  • 14. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep InternalMySQL/InnoDB MVCC Architecture Rseg 0 (0,6) Rseg 1 … Rseg 33 (1,3) Rseg 127 ibdata1 space 0 Page 0 Page 1 … Page 5 … (0,5) TRX_SYS System Tablespace T1.ibd space f9 Page 0 … Page 3 Page 4 … Page 64 Page (f9,3) Rec001, B (TRX_ID 0x778c) Buffer Pool User Tablespace slot 0 4 slot 1 5 … slot 1023 (1,3) Rollback Segment Undo Tablespace TRX_SYS max_trx_id = 0x778e rw_trx_list->count = 0 mvcc->m_views->count = 2 m_views->start = 0x35dd068 Readview : 0x35dd068 m_low_limit_no = 0x778e m_low_limit_id = 0x778e m_up_limit_id = 0x778e m_ids->m_size = 0 0x7f02083b4000 Undo Page (1,5) Rec001, A (TRX_ID 0x778b) 0x7f0208608000 Data Page (f9,3) Rec001, B (TRX_ID 0x778c, ROLL_PTR (5,6d1)) Undo Page (1,5) (0x6d1) Rec001, A (TRX_ID 0x778b) (1,5) Undo log Session 0 Select * from t1; Rec001, A Readview : 0x35dd108 Session 1 4. 세션2 Select Select * from t1; Rec001, B Readview : 0x35dd068 Session 2 Readview : 0x35dd108 m_low_limit_no = 0x778c m_low_limit_id = 0x778c m_up_limit_id = 0x778c m_ids->m_size = 0
  • 15. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep InternalMySQL/InnoDB MVCC Architecture Rseg 0 (0,6) Rseg 1 … Rseg 33 (1,3) Rseg 127 ibdata1 space 0 Page 0 Page 1 … Page 5 … (0,5) TRX_SYS System Tablespace T1.ibd space f9 Page 0 … Page 3 Page 4 … Page 64 Page (f9,3) Rec001, C (TRX_ID 0x778e) Buffer Pool User Tablespace slot 0 4 slot 1 5 … slot 1023 (1,3) Rollback Segment Undo Tablespace TRX_SYS max_trx_id = 0x778e rw_trx_list->count = 0 mvcc->m_views->count = 2 m_views->start = 0x35dd068 Readview : 0x35dd068 m_low_limit_no = 0x778e m_low_limit_id = 0x778e m_up_limit_id = 0x778e m_ids->m_size = 0 (1,5) Undo log Update t1 set c2 = C; Session 0 Select * from t1; Rec001, A Readview : 0x35dd108 Session 1 5. 세션0 Update Select * from t1; Rec001, B Readview : 0x35dd068 Session 2 Readview : 0x35dd108 m_low_limit_no = 0x778c m_low_limit_id = 0x778c m_up_limit_id = 0x778c m_ids->m_size = 0 TRX ID 0x778e addr=0x1b74a750 0x7f02083b4000 Undo Page (1,5) (0x6d1) Rec001, A (TRX_ID 0x778b) 0x7f02083b4000 Undo Page (1,5) (0x7be) Rec001, B (TRX_ID 0x778c ROLL_PTR (5,6d1)) 0x7f0208608000 Data Page (f9,3) Rec001, B (TRX_ID 0x778c, ROLL_PTR (5,6d1)) Undo Page (1,5) 0x6d1 Rec001, A (TRX_ID 0x778b) Undo Page (1,5) (0x7be) Rec001, B (TRX_ID 0x778c ROLL_PTR (5,6d1))
  • 16. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep InternalMySQL/InnoDB MVCC Architecture Rseg 0 (0,6) Rseg 1 … Rseg 33 (1,3) Rseg 127 ibdata1 space 0 Page 0 Page 1 … Page 5 … (0,5) TRX_SYS System Tablespace T1.ibd space f9 Page 0 … Page 3 Page 4 … Page 64 Page (f9,3) Rec001, C (TRX_ID 0x778e) Buffer Pool User Tablespace slot 0 4 slot 1 5 … slot 1023 (1,3) Rollback Segment Undo Tablespace TRX_SYS max_trx_id = 0x7790 rw_trx_list->count = 0 mvcc->m_views->count = 3 m_views->start = 0x35ddfc8 Readview : 0x35dcfc8 m_low_limit_no = 0x7790 m_low_limit_id = 0x7790 m_up_limit_id = 0x7790 m_ids->m_size = 0 (1,5) Undo log Session 0 Select * from t1; Rec001, A Readview : 0x35dd108 Session 1 6. 세션3 Select Select * from t1; Rec001, B Readview : 0x35dd068 Session 2 Readview : 0x35dd068 m_low_limit_no = 0x778e m_low_limit_id = 0x778e m_up_limit_id = 0x778e m_ids->m_size = 0 0x7f02083b4000 Undo Page (1,5) (0x6d1) Rec001, A (TRX_ID 0x778b) 0x7f02083b4000 Undo Page (1,5) (0x7be) Rec001, B (TRX_ID 0x778c ROLL_PTR (5,6d1)) 0x7f0208608000 Data Page (f9,3) Rec001, C (TRX_ID 0x778e, ROLL_PTR (5,7be)) Undo Page (1,5) 0x6d1 Rec001, A (TRX_ID 0x778b) Undo Page (1,5) (0x7be) Rec001, B (TRX_ID 0x778c ROLL_PTR (5,6d1)) Select * from t1; Rec001, C Readview : 0x35ddfc8 Session 2 Readview : 0x35dd108 m_low_limit_no = 0x778c m_low_limit_id = 0x778c m_up_limit_id = 0x778c m_ids->m_size = 0
  • 17. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep InternalReadview 정의 및 목적 • 트랜잭션이 발생하면, COMMIT 시점이 아닌 트랜잭션 시작 시점의 TRX_ID 가 저장됨 • 쿼리 시작시점의 액티브 트랜잭션들의 집합 (COMMIT/ROLLBACK 하지 않은 상태) • MVCC 구현에 반드시 필요 Component Description low_limit_no - 해당 값을 Purge thread가 참조하여 불필요한 Undo log들을 처리하는 purge 작업에 사용된다. - low_limit_no = Readview 생성시 trx_sys의 max_trx_id값 low_limit_id - low_limit_id보다 크거나 같은 TRX_ID (trx_id >= low_limit_id) 는 해당 readview에서 조회 안 됨 - low_limit_id = Readview 생성시 trx_sys의 max_trx_id값 up_limit_id - up_limit_id(trx_id < up_limit_id) 보다 작은 트랜잭션 TRX_ID 는 해당 readview에서 모두 조회됨 - up_limit_id = readview 생성시, active 트랜잭션 중 가장 작은 TRX_ID trx_ids[] - 모든 액티브 트랜잭션 id로 구성된 그룹 view_list - Readview list (doubly linked list)
  • 18. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep InternalReadview New TRX Structure mutex max_trx_id = 0x98fd rw_trx_list count = 3 start = 0x4fe4fae0 mvcc->m_views count = 3 start = 0x25b9f08 … trx_sys Trx linked list trx id = 0x98fc update_undo : page_no = 6 offset = 0x86c trx_list prev = 0x00 next = 0x4fe4fe70 … trx id = 0x98fb update_undo : page_no = 7 offset = 0x370 trx_list prev = 0x4fe4fae0 next = 0x4fe4f750 … trx id = 0x98f8 update_undo : page_no = 5 offset = 0x2c4 trx_list prev = 0x4fe4fe70 next = 0x00 … trx0 0x4fe4fae0 trx1 0x4fe4fe70 trx2 0x4fe4f750 New Readview Readview linked list m_low_limit_no = 0x98fd m_low_limit_id = 0x98fd m_up_limit_id = 0x98f8 m_view_list prev = 0x0 next = 0x25b9fa8 m_ids->m_size = 3 m_ids[0] = 0x98f8 m_ids[1] = 0x98fb m_ids[2] = 0x98fc readview0 0x25b9f08 m_low_limit_no = 0x98fc m_low_limit_id = 0x98fc m_up_limit_id = 0x98f8 m_view_list prev = 0x25b9f08 next = 0x25ba048 m_ids->m_size = 2 m_ids[0] = 0x98f8 m_ids[1] = 0x98fb readview1 0x25b9fa8 m_low_limit_no = 0x98fb m_low_limit_id = 0x98fb m_up_limit_id = 0x98f8 m_view_list prev = 0x25b9fa8 next = 0x0 m_ids->m_size = 1 m_ids[0] = 0x98f8 readview2 0x25ba048
  • 19. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep InternalReadview 1. t1 Table 생성 create table t1 (id int primary key, comment char(50), filler char(2)) engine = innodb; 2. Secondary index 생성 create index test_idx on test(comment); T1.ibdspace173 Page 0 Page 1 Page 2 Page 3 Page 4 Page 5 … UNDO001space1 Page 0 Page 1 Page 2 Page 3 Page 4 Page 5 … Secondary Index source : InnoDBTransaction/Lock/Multi-version analysis, 网易杭研-何登成 Clustering Index Page 4
  • 20. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep InternalReadview 3. TRX_ID가 0x96f6 일때, t1에 1건 Insert insert into t.test values (65, 'aaa',' ') ; T1.ibdspace173 Page 0 Page 1 Page 2 Page 3 Page 4 Page 5 … Deleted: 0 65 DB_TRX_ID (0x96f6) DB_ROLL_PTR (4,110) aaa Deleted: 0 aaa PK: 65 UNDO001space1 Page 0 Page 1 Page 2 Page 3 Page 4 Page 5 … Insert Undo aaa PK: 65 source : InnoDBTransaction/Lock/Multi-version analysis, 网易杭研-何登成 Secondary Index Clustering Index Page 4
  • 21. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep InternalReadview 4. Primary key 업데이트 update t.test set id = 67 where id = 65 ; T1.ibdspace173 Page 0 Page 1 Page 2 Page 3 Page 4 Page 5 … Deleted: 1 65 DB_TRX_ID (0x96fc) DB_ROLL_PTR (7,110) aaa Deleted: 1 aaa PK: 65 UNDO001space1 Page 0 Page 1 Page 2 Page 3 Page 4 … Page 7 Update Undo aaa PK: 65 source : InnoDBTransaction/Lock/Multi-version analysis, 网易杭研-何登成 • 새로운 레코드 (67, aaa)가 추가됨 (Insert 발생하는 것처럼 Insert Undo에 저장) • 이전 레코드 (65, aaa)는 삭제 표시됨 (삭제 flag, trx_id, roll_ptr를 설정하고, before-image를 Update Undo에 저장) • Secondary Index 페이지에서도 레코드 (aaa, 65) 는 삭제 설정하고 레코드 (aaa,67)가 추가됨 Deleted: 0 67 DB_TRX_ID (0x96fc) DB_ROLL_PTR (4,11d) aaa Deleted: 0 aaa PK: 67 Insert Undo aaa PK: 67 Secondary Index Clustering Index Page 4 Page 7
  • 22. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep InternalReadview 5. Secondary key 업데이트 update t.test set comment = 'ccc' where id = 67 ; T1.ibdspace173 Page 0 Page 1 Page 2 Page 3 Page 4 Page 5 … Deleted: 1 65 DB_TRX_ID (0x96fc) DB_ROLL_PTR (7,110) aaa Deleted: 1 aaa PK: 65 UNDO001space1 Page 0 Page 1 Page 2 Page 3 Page 4 … Page 7 Update Undo aaa PK: 65 source : InnoDBTransaction/Lock/Multi-version analysis, 网易杭研-何登成 • 레코드 (67,aaa)를 레코드 (67,ccc)로 변경하고, before-image를 Update Undo에 저장 • Secondary Index 페이지에서도 레코드 (aaa,67)는 삭제 설정되고, 레코드 (ccc,67)가 추가됨. Deleted: 0 67 DB_TRX_ID (0x9700) DB_ROLL_PTR (7,224) ccc Deleted: 1 aaa PK: 67 Update Undo aaa PK: 67 Deleted: 0 ccc PK: 67 Secondary Index Clustering Index Page 7
  • 23. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep InternalReadview Session 0 (DML) Session 1 (DML) Session 2 (DML) Session 3 (Read) Session 4 (Read) Session 5 (Read) UPDATE (67, ‘ccc’) INSERT (65, ‘aaa’) UPDATE (67, ‘aaa’) 0x96f5 0x96f6 0x96fb 0x96fc 0x97000x96ff 0x97060x96fd 0x97090x9705 READVIEW 0 0x25c0ee8 UP:0x96f5 ~ LOW:0x96fd Trx:0x96f5, 0x96fb, 0x96fc Select * from test (65,aaa) READVIEW 1 0x25c0e48 UP:0x96fb ~ LOW:0x9705 Trx:0x96fb, 0x96ff, 0x9700 Select * from test (67,aaa) READVIEW 2 0x25c0da8 UP:0x9706~ LOW:0x9709 Trx:0x9706 Select * from test (67,ccc) TX 0x96f5 TX 0x96fb TX 0x96fc TX 0x9700 TX 0x96ff TX 0x9706
  • 24. MySQL Deep Internal © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. MySQL Deep Internal source : InnoDBTransaction/Lock/Multi-version analysis, 网易杭研-何登成 Readview select * from t1; case up_limit_id low_limit_id trx_ids [ ] query result Readview0 Primary Key 변경 0x96f5 0x96fd 0x96f5, 0x96fb, 0x96fc (65, aaa) Readview1 Secondary Key 변경 0x96fb 0x9705 0x96fb, 0x96ff, 0x9700 (67, aaa) Readview2 해당 테이블에 트랜잭션이 없을 경우 0x9706 0x9709 0x9706 (67, ccc)
  • 25. © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. NAVER http://cafe.naver.com/playexem ITPUB (中) http://blog.itpub.net/31135309/ Wordpress https://playexem.wordpress.com/ Slideshare http://www.slideshare.net/playexem 교육 문의 edu@ex-em.com EXEM Research & Contents Team Youtube https://www.youtube.com/channel/UC5wKR _-A0eL_Pn_EMzoauJg Tudou (中) http://www.tudou.com/home/maxgauge/
  • 26. © Copyrights 2001~2017 EXEM CO.,LTD. All Rights Reserved. 감사합니다