Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Jan 21, 2024
1 parent a1f9c3b commit 72a93da
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/faq/backend/db_isolation_levels.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Consistent reads within the same transaction read the snapshot established by th

- https://blog.amis.com/database-transaction-isolation-a1e448a7736e
- https://www.mysql.tw/2023/05/mysql-lock.html
- https://fanyilun.me/2015/12/29/%E4%BA%8B%E5%8A%A1%E7%9A%84%E9%9A%94%E7%A6%BB%E7%BA%A7%E5%88%AB%E4%BB%A5%E5%8F%8AMysql%E4%BA%8B%E5%8A%A1%E7%9A%84%E4%BD%BF%E7%94%A8/
- https://blog.csdn.net/weixin_45670060/article/details/119977481
- https://ithelp.ithome.com.tw/articles/10194749
- https://myapollo.com.tw/blog/database-transaction-isolation-levels/
Expand Down
27 changes: 26 additions & 1 deletion doc/faq/backend/lock.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,33 @@ unlock tables


#### 行級鎖
- InnoDB 引擎是支援行級鎖定的,而 MyISAM 引擎並不支援行級鎖定

```sql
# sql

# SQL client 1
# 对读取的记录加共享锁
# select * from accounts where id = 5 lock in share mode;
select * from authors where id = 1 lock in share modes;


# 对读取的记录加独占锁
select * from authors for update;

# SQL client 2
```


### 2) Redis Lock

### 3) Zookeeper (ZK) Lock
### 3) Zookeeper (ZK) Lock

### 4) Modern DB deal with concurrence:

- Types
- 2PL (2 phase locking)
- MVCC (Multiversion concurrency control) (多版本並行控制)

- Ref
- https://www.fanyilun.me/2017/04/20/MySQL%E5%8A%A0%E9%94%81%E5%88%86%E6%9E%90/?source=post_page-----19833c18baab--------------------------------

0 comments on commit 72a93da

Please sign in to comment.