Project 4
讲义
Gitbook
简书
视频
博客
- 【CMU15445】Project 4 - Concurrency Control | 册页晚的学习笔记
- CMU15445-2022 P4 Concurrency Control - 知乎
- 做个数据库:2022 CMU15-445 Project4 Concurrency Control - 知乎
- BusTub2022-Solution/BusTub-Lab4.md at master · Fischer0522/BusTub2022-Solution · GitHub
Github
- bustub/lock_manager.cpp at master · ejunjsh/bustub · GitHub
- cmu15445/lock_manager.cpp at master · JiahaoZou/cmu15445 · GitHub
- CMU15-445-2022fall/lock_manager.cpp at main · Jiodah/CMU15-445-2022fall · GitHub
实现
Delete
bustub> explain delete from t1 where v1 = 1;
=== BINDER ===
Delete { table=BoundBaseTableRef { table=t1, oid=22 }, expr=(t1.v1=1) }
=== PLANNER ===
Delete { table_oid=22 } | (__bustub_internal.delete_rows:INTEGER)
Filter { predicate=(#0.0=1) } | (t1.v1:INTEGER)
SeqScan { table=t1 } | (t1.v1:INTEGER)
=== OPTIMIZER ===
Delete { table_oid=22 } | (__bustub_internal.delete_rows:INTEGER)
SeqScan { table=t1, filter=(#0.0=1) } | (t1.v1:INTEGER)
Index
CREATE TABLE nft(id INT, terrier INT);
CREATE INDEX nftid ON nft(id);
INSERT INTO nft VALUES (0, 0), (1, 1);
EXPLAIN UPDATE nft SET terrier = 2 WHERE id = 1;
EXPLAIN SELECT * FROM nft WHERE id = 1;
EXPLAIN SELECT * FROM nft;
SELECT * FROM nft WHERE id = 1;
Q&A
1. For an insert operation, what should we locked? The rid is determined after the insert.
You can first insert then lock. This is a long-term bug to be fixed.
2. Halloween problem
- SQL 中的 Halloween Problem - 知乎
- test/sql/p3.03-update.slt `update t1 set v3 = 445 where v1 >= 3;