Notes: Spanner
Prelude
Notes on Spanner internals referencing publicly available literature e.g. Alex Petrov’s Database Internals book and the Spanner paper presented at OSDI.
Notes
A Spanner zone is “the unit of administrative deployment” and is composed of a zonemaster, spanservers, and per-zone location proxies
The zonemaster assigns data to spanservers
spanservers are the indiudual units of Spanner that serve data clients.
A spanserver is responsible for between 100 and 1000 instances of a data strcuture called a tablet
A tablet is essentially a bag of key-value mappings
location proxies are used by clients to locate the spanservers that contain their data
spanservers “implement a single Paxos state machine on top of each tablet”. The set of replicas is called a Paxos group
The leader in each Paxos group manages 2 additional systems: a lock table and a transaction manager. The state of these systems is still replicated by the Paxos group.
“The lock table contains the state for two-phase locking: it maps ranges of keys to lock states.”
The transaction manager supports distributed transactions i.e. transactions that span multiple Paxos groups.
- The transaction manager will coordinate with the leaders of the other Paxos groups participating in the transaction to perform two-phase commit. One of the participant groups will be selected as the coordinator leader.
Useful references
- Alex Petrov - Database Internals - Chapter 13: Distributed Transactions
- Spanner - Google’s Globally-Distributed Database