← Lessons

quiz vs the machine

Platinum1850

Databases

Isolation In Distributed Databases

Spanning nodes turns isolation into a coordination and clock problem.

6 min read · advanced · beat Platinum to climb

Why It Gets Harder

In a single node, one lock manager and one clock order all transactions. In a distributed database, data lives on many nodes, so enforcing isolation requires nodes to agree on an order across the network.

Coordination Mechanisms

  • Two phase commit ensures a multi node transaction either commits everywhere or aborts everywhere, but it blocks if the coordinator fails.
  • Distributed locking holds locks across nodes, raising the risk of cross node deadlocks that need a global detector.
  • Timestamp ordering assigns each transaction a globally meaningful timestamp so all nodes apply a consistent order.

The Clock Problem

To order transactions across nodes you need agreement on time. Approaches include a central timestamp oracle, logical clocks like Lamport or hybrid logical clocks, and bounded physical clocks such as Google Spanner's TrueTime, which waits out clock uncertainty to guarantee external consistency.

The Tradeoff

Stronger global isolation like serializability costs more cross node coordination and latency. Many systems offer weaker but cheaper guarantees per partition and reserve full serializability for transactions that need it.

Key idea

Distributed isolation needs cross node agreement on transaction order, achieved through commit protocols, distributed locks, and synchronized or bounded clocks at the cost of latency.

Check yourself

Answer to earn rating on the learn ladder.

1. Why is isolation harder in a distributed database?

2. What does Spanner's TrueTime do?

3. What is a risk of distributed locking?