G16 · Design a Globally Consistent DB (Spanner-like) G16 · 设计全球一致 DB(Spanner 风格)
Verified source经核实出处
Spanner paper (OSDI 2012). Classic Google interview. Credibility A.
Key decisions关键决策
- **TrueTime**: GPS + atomic clocks give bounded uncertainty; commit waits past uncertainty for external consistency.**TrueTime**:GPS + 原子钟给出有界不确定;commit 等待不确定度保外部一致。
- **Paxos groups per shard**; 2PC coordinator for cross-shard txns.**每 shard 一 Paxos 组**;跨 shard 事务用 2PC 协调者。
- **Read-only txns** use past timestamp; lock-free, globally consistent.**只读事务**用过去时间戳;免锁且全局一致。
- **Schema leases + follower reads** for low-latency reads.**Schema 租约 + follower 读**降低读延迟。
Follow-ups追问
- Without TrueTime? CockroachDB's HLC + uncertainty windows.没有 TrueTime?CockroachDB 的 HLC + 不确定窗口。