CockroachDB, The Resilient Geo-Distributed SQL Database
Personal notes on the CockroachDB paper that was presented in SIGMOD 2020.
Personal notes on the CockroachDB paper that was presented in SIGMOD 2020.
Notes Types of locks - Write lock Read lock Predicate lock - Lock where multiple rows are locked for reads(WHERE clause) All of these locks are long locks(Meaning all are acquired first and then all are released)(2 Phase locking) If we wanna improve performance(and decrease isolation levels), we can reduce long locks to short locks. Types of anomalies - Phantom Reads is we do a search condition (using WHERE clause) and then Read1, Write1 and Read2. Read1 =/= Read2. Fuzzy Reads is Read1, Write1 and Read2. Read1 =/= Read2. Dirty Reads is where we can read an uncommitted value of a transaction. Read Skew is where Tx 1 has a write(x) and then read(y) and Tx 2 has a write(y) and then read(x) causing the system to be non-serializable. Write Skew is where Tx 1 has a read(x) and then write(y) and Tx 2 has a read(y) and then write(x) causing the system to be non-serializable. ...
Notes Two strategies for implementing deadlock prevention used in 2-phase locking Wound wait - Force the lock to release from another transaction Wait die - Wait for lock to be released or die https://stackoverflow.com/questions/32794142/what-is-the-difference-between-wait-die-and-wound-wait-deadlock-prevention-a Distributed Transactions Two problems with distributed transactions Write ahead logging needs to happen on each shard There needs to be a flag on each shard indicating that its in the commit phase (because otherwise locks would be wounded) This is solved using 2-phase commit ...