2024.07.09 locking Introduction
https://dev.mysql.com/blog-archive/innodb-data-locking-part-1-introduction/
MySQL :: InnoDB Data Locking - Part 1 "Introduction"
In this blog series, I’d like to introduce you gently to the topic on which I was working last 2 years, which is improving how InnoDB locks data (tables and rows) in order to provide illusion to clients that their queries are executed one after another,
dev.mysql.com
음
innodb가 lock을 어떻게 관리하는지 설명한다.
lock을 fifo방식으로 관리하는데 더 나아가 우선순위 큐 형태로 관리한다. 한 줄로 세운 것 중에서 더 중요한 게 있을 수 있다는 것이다.
또 readview를 알려주는데 이는 이전에 보았던 mvcc 개념에서 나오는 것이다. repeatable read 수준에서 select와 select for share는 다른 곳을 본다는 것.
데드락이 있을 때 감지 혹은 타임아웃으로 처리할 수 있다는 것.
그래도 데드락 방지를 위해 각 트랜잭션이 일관된 순서로 읽으면 데드락을 예방할 수 있다.
https://dev.mysql.com/blog-archive/innodb-data-locking-part-2-locks/
MySQL :: InnoDB Data Locking - Part 2 "Locks"
In InnoDB Data Locking – Part 1 “Introduction” we’ve described the difficulties Lock System tries to solve using metaphor of people trying to concurrently edit spreadsheets. While it might be useful metaphor to get some intuitions about the problem
dev.mysql.com
다음은 이거 읽기
part 3에 스케줄링 이야기가 나오는데 앞에서 봤던 fifo의 연장선이다.
당근에서도 글이 있다.
다 읽고 전반적인 정리를 해봐야할 듯.
https://medium.com/daangn/mysql-cats-contention-aware-transaction-scheduling-71fe6956e87e
MySQL CATS (Contention-Aware Transaction Scheduling)
전통적으로 MySQL 서버는 트랜잭션의 잠금 허가(Grant)는 순수하게 대기(Waiting) 순서에 의존했는데, 이를 FCFS(First Come First Served, 또는 FIFO라고도 함) 스케쥴링이라고 해요. 하지만 이런 FCFS 기반의…
medium.com