Proof of Work

Notes Bitcoin Reasoning for making bitcoin Anonymous Decentralized money system No trust in the government money system How does this work in a no trust environment? Use asymmetric encryption scheme like public/private key pairs. Double spend problem Double spend (make a transaction and then unrecord it and then spend that money again) How do you solve this? Similar to the consensus problem where everyone must agree on transactions. We can’t use consensus algos like Paxos or RAFT because its not a closed membership situation(no global view of number of servers....

Critique of ANSI SQL Isolation Levels

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....

Percolator

Notes Bigtable doesn’t support multi-row/multi-table transactions. Why does Google need multi-table transactions? Removing duplicates(Multiple URLs may lead to the same website), calculation of pagerank will get affected. Built on top of big table, because didn’t have that many people working on it and also didn’t have source code access to big table. Locks Locks in percolator could have been implemented in two ways - In place(in database) Problem with this is that you can’t maintain complex locks with queues and techniques like wound wait, wait die, etc....

Spanner

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...

Serializability

Important Reading to help understand: https://jepsen.io/consistency Notes A - Atomicity (All or nothing of a transaction) C - Consistency (Consistent with the constraints on database tables) I - Isolation D - Durability (Handling reboots/failures) Isolation 3 types of dependencies that can help determine serializability - Write - Write Dependency Write - Read Dependency Read - Write Dependency (Anti dependency) Anti Dependency: An anti-dependency, also known as write-after-read (WAR), occurs when an instruction requires a value that is later updated....