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.
감사합니다
Ad

More Related Content

What's hot (20)

MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptx
NeoClova
 
Introduction VAUUM, Freezing, XID wraparound
Introduction VAUUM, Freezing, XID wraparoundIntroduction VAUUM, Freezing, XID wraparound
Introduction VAUUM, Freezing, XID wraparound
Masahiko Sawada
 
MySQL innoDB split and merge pages
MySQL innoDB split and merge pagesMySQL innoDB split and merge pages
MySQL innoDB split and merge pages
Marco Tusa
 
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
Jean-François Gagné
 
MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용
I Goo Lee
 
Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability
Mydbops
 
PostgreSQL Deep Internal
PostgreSQL Deep InternalPostgreSQL Deep Internal
PostgreSQL Deep Internal
EXEM
 
MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바
NeoClova
 
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
Jean-François Gagné
 
Optimizing queries MySQL
Optimizing queries MySQLOptimizing queries MySQL
Optimizing queries MySQL
Georgi Sotirov
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
EDB
 
How to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better PerformanceHow to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better Performance
oysteing
 
SQL serverのデータ破損に備える
SQL serverのデータ破損に備えるSQL serverのデータ破損に備える
SQL serverのデータ破損に備える
okumar savurou
 
MySQL GTID 시작하기
MySQL GTID 시작하기MySQL GTID 시작하기
MySQL GTID 시작하기
I Goo Lee
 
Parallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBParallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDB
Mydbops
 
InnoDB Internal
InnoDB InternalInnoDB Internal
InnoDB Internal
mysqlops
 
MySQL Architecture and Engine
MySQL Architecture and EngineMySQL Architecture and Engine
MySQL Architecture and Engine
Abdul Manaf
 
Tanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools short
Tanel Poder
 
ヤフー社内でやってるMySQLチューニングセミナー大公開
ヤフー社内でやってるMySQLチューニングセミナー大公開ヤフー社内でやってるMySQLチューニングセミナー大公開
ヤフー社内でやってるMySQLチューニングセミナー大公開
Yahoo!デベロッパーネットワーク
 
Introduction to Vacuum Freezing and XID
Introduction to Vacuum Freezing and XIDIntroduction to Vacuum Freezing and XID
Introduction to Vacuum Freezing and XID
PGConf APAC
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptx
NeoClova
 
Introduction VAUUM, Freezing, XID wraparound
Introduction VAUUM, Freezing, XID wraparoundIntroduction VAUUM, Freezing, XID wraparound
Introduction VAUUM, Freezing, XID wraparound
Masahiko Sawada
 
MySQL innoDB split and merge pages
MySQL innoDB split and merge pagesMySQL innoDB split and merge pages
MySQL innoDB split and merge pages
Marco Tusa
 
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
Jean-François Gagné
 
MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용MySQL 상태 메시지 분석 및 활용
MySQL 상태 메시지 분석 및 활용
I Goo Lee
 
Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability
Mydbops
 
PostgreSQL Deep Internal
PostgreSQL Deep InternalPostgreSQL Deep Internal
PostgreSQL Deep Internal
EXEM
 
MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바MySQL Advanced Administrator 2021 - 네오클로바
MySQL Advanced Administrator 2021 - 네오클로바
NeoClova
 
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
Jean-François Gagné
 
Optimizing queries MySQL
Optimizing queries MySQLOptimizing queries MySQL
Optimizing queries MySQL
Georgi Sotirov
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
EDB
 
How to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better PerformanceHow to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better Performance
oysteing
 
SQL serverのデータ破損に備える
SQL serverのデータ破損に備えるSQL serverのデータ破損に備える
SQL serverのデータ破損に備える
okumar savurou
 
MySQL GTID 시작하기
MySQL GTID 시작하기MySQL GTID 시작하기
MySQL GTID 시작하기
I Goo Lee
 
Parallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBParallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDB
Mydbops
 
InnoDB Internal
InnoDB InternalInnoDB Internal
InnoDB Internal
mysqlops
 
MySQL Architecture and Engine
MySQL Architecture and EngineMySQL Architecture and Engine
MySQL Architecture and Engine
Abdul Manaf
 
Tanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools short
Tanel Poder
 
Introduction to Vacuum Freezing and XID
Introduction to Vacuum Freezing and XIDIntroduction to Vacuum Freezing and XID
Introduction to Vacuum Freezing and XID
PGConf APAC
 

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
Linaro
 
[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 Skills
Asuka 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 assembly
Marian Marinov
 
Cisco IOS shellcode: All-in-one
Cisco IOS shellcode: All-in-oneCisco IOS shellcode: All-in-one
Cisco IOS shellcode: All-in-one
DefconRussia
 
Introduction to Reactive Extensions (Rx)
Introduction to Reactive Extensions (Rx)Introduction to Reactive Extensions (Rx)
Introduction to Reactive Extensions (Rx)
Tamir Dresher
 
MySQL8.0 in COSCUP2017
MySQL8.0 in COSCUP2017MySQL8.0 in COSCUP2017
MySQL8.0 in COSCUP2017
Shinya Sugiyama
 
r2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCyr2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCy
Ray 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, 2020
Geir Høydalsvik
 
Cisc mc68000
Cisc mc68000Cisc mc68000
Cisc mc68000
Nazir Ahmed
 
microprocessors
microprocessorsmicroprocessors
microprocessors
Hossam Zein
 
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
corehard_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 assignments
solved_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
Roberto Agostino Vitillo
 
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
Linaro
 
[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 Skills
Asuka 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 assembly
Marian Marinov
 
Cisco IOS shellcode: All-in-one
Cisco IOS shellcode: All-in-oneCisco IOS shellcode: All-in-one
Cisco IOS shellcode: All-in-one
DefconRussia
 
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 r2cLEMENCy
Ray 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, 2020
Geir 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 Engineering
corehard_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 assignments
solved_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
Roberto Agostino Vitillo
 
Ad

Recently uploaded (20)

Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Ad

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 교육 문의 [email protected] 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. 감사합니다