April 22, 2021
How do we uphold these guarantees across multiple databases?
Each node has to make local decisions
without global state.
Nodes might see operations in a different order.
Idea 1: Route all requests through one node
Idea 2: Have one node define a serial order
Force each node's interactions to obey the order.
Node 1 commits transaction
Node 2 commits transaction
Client: ???
Node 1 → Client: Commit
Node 2 → Client: Commit
Client sees transaction as committed
Node 1 commits transaction
Node 2 aborts transaction
Node 1 → Client: Commit
Node 2 → Client: Abort
Client sees transaction as aborted?
Node 1 committed the transaction.
(This is called Two-Phase Commit)
What kinds of failures can we tolerate?
Periodically re-send messages
Pre-commit is idempotent
Re-receiving a pre-commit doesn't
change the commit status.
Log commit status in case of repeat requests.
What kinds of failures can we tolerate?
If the node guarantees Durability,
it will come up in the same state.
Failure = Dropped Message
What kinds of failures can we tolerate?
The node never comes back up.
When is the write durable?
Never!
How much durability do you need?
Idea: Replicate data to multiple nodes/sites/planets...
Idea: Do something like 2-Phase Commit
Some replicas have T1 then T2.
Some have T2 then T1.
Under 2PC, some nodes abort T1 and some abort T2.
Idea: Majority vote
$N$ Replicas
$> \frac{N}{2}$ votes needed for a commit.
What is a success?
A "successful" read reads the written value.
Can we do better than 2PC?
We need to ensure that Bob sees at least one copy of Alice's write
Alice gets confirmation from $A$ nodes
Bob reads from $B$ nodes
If $A+B > N$ then Bob must read at least one of Alice's writes
What does a node assume when it fails to receive a message?