Skip to main content
ARCHOS 525 BLUEPRINT · /d/dgm_int-newsql

Distributed SQL (Spanner / CockroachDB) Internals (Raft Ranges & 2PC)

8 COMPONENTS · 7 FLOWS · UPDATED 2026-11-24
GITHUB README / PR PREVIEW CARD
[![Distributed SQL (Spanner / CockroachDB) Internals (Raft Ranges & 2PC) — ArchOS Architecture](https://archos.sageideas.dev/d/dgm_int-newsql/opengraph-image)](https://archos.sageideas.dev/d/dgm_int-newsql)

*Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_int-newsql)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_int-newsql" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Distributed SQL (Spanner / CockroachDB) Internals (Raft Ranges & 2PC) — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
  client_0["SQL Client"]
  gw_1["SQL Gateway Node"]
  hlc_2["TrueTime / HLC Clock"]
  r1_3[("Range 1 Raft Group")]
  r2_4[("Range 2 Raft Group")]
  peb_5[("RocksDB / Pebble KV")]
  fol_6[("Raft Followers")]
  downstream_7["Downstream & OTel"]
  client_0 -->|"1. BEGIN..COM · SQL"| gw_1
  gw_1 -->|"2a. Stamp · Clock"| hlc_2
  gw_1 -->|"2b. Stage TX · gRPC"| r1_3
  gw_1 -->|"2c. Write · gRPC"| r2_4
  r1_3 -->|"3a. Persist · LSM"| peb_5
  r2_4 -->|"3b. Raft · Raft"| fol_6
  fol_6 -.->|"4. Emit / · OTLP/API"| downstream_7

COMPONENT STACK (8)

  • SQL ClientSTATELESS
    Serializable TX
  • SQL Gateway NodeSTATELESS
    Distributed SQL planner & 2PC coord
  • TrueTime / HLC ClockSTATELESS
    Bounded clock uncertainty [e]
  • Range 1 Raft GroupSTATEFUL
    Keys [A..M] · Leaseholder
  • Range 2 Raft GroupSTATEFUL
    Keys [N..Z] · Leaseholder
  • RocksDB / Pebble KVSTATEFUL
    MVCC timestamped intents
  • Raft FollowersSTATEFUL
    Quorum log replication
  • Downstream & OTelSTATELESS
    Consumers, metrics & SLOs

REQUEST & DATA FLOW (7)

  1. SQL Client → SQL Gateway Node (BEGIN..COM)[SQL]
  2. SQL Gateway Node → TrueTime / HLC Clock (Stamp)[Clock]
  3. SQL Gateway Node → Range 1 Raft Group (Stage TX)[gRPC]
  4. SQL Gateway Node → Range 2 Raft Group (Write)[gRPC]
  5. Range 1 Raft Group → RocksDB / Pebble KV (Persist)[LSM]
  6. Range 2 Raft Group → Raft Followers (Raft)[Raft]
  7. Raft Followers → Downstream & OTel (Emit /)[OTLP/API]
Configure NGINX / Postgres / K8s →60-Sec L4–L7 Diagnostic →