CHAPTER DEEPREAD · SRE · CH 26
Site Reliability Engineering · Ch 26 · Google · 2016
The photos on your phone, a chat thread from four years ago, the contract in your cloud drive — you simply assume they are still there, and still exactly as you left them. This chapter is about that assumption: how do you make sure that when you open it, the thing is still there and hasn't been quietly mangled? It was written by two Google engineers who run Gmail and Google Drive — systems where losing a single item makes the news.
Most people think: "I keep three copies, what could go wrong?" But three copies are exactly what will not save you. If you delete a file by accident, all three copies vanish within a second — none left. Extra copies protect you from a machine dying. They do not protect you from a person or a program doing the wrong thing. The book puts it bluntly: more copies is not the same as being able to get it back.
There are too many ways for data to go bad: a user slips, an operator types the wrong command, a program bug deletes in bulk, a disk quietly rots, a data center floods. Worse, the tempo differs too. Some losses happen all at once and you know immediately. Others leak a little every day, and by the time anyone notices six months later, the last clean copy has already aged out and been thrown away. No single trick covers all of that, which is why this chapter's answer is: put up three doors.
Door one is the trash can. Deleted things aren't really deleted — they get a "deleted" tag and sit there for a while before being cleaned out. This catches the most common accident by far: the slip, and the malicious wipe after someone's account is stolen. Undoing it costs essentially nothing: remove the tag.
Door two is the old photo album in a safe. Periodically copy everything to somewhere far away, disconnected, and untouchable — Google used tape. Precisely because it is physically cut off from the live system, whatever mess you make online cannot reach it. But the question that matters isn't "did we make a copy". It's "when did we last actually take it out and use it?"
Door three is the clerk who counts the stock every day. A separate program constantly reconciles the data: does this song's record still point at a real audio file? Do the two ledgers add up? It prevents nothing. Its entire value is that it lets you find out before your users complain — because every day you find out late is a day the clean copy in the safe gets closer to expiring.
The most useful line in the chapter: stop asking "do we have backups?" and start asking "when did we last restore everything, end to end, and how long did it take?" In real incidents, most teams' backup jobs report success every single day — nobody had ever tried loading one back. They find out on the day it matters. One honest cost: all three doors take real money (an extra copy is storage, daily counting is compute, rehearsing a restore takes people), and the trash can has an awkward side — the thing you thought you deleted is still lying around somewhere for a while.
Extra copies protect you from machines failing, not from people and programs doing the wrong thing. What actually saves you is three doors: a trash can, an offline backup, and daily stock-counting. And to judge whether a team is serious, one question is enough: when did you last actually restore?
Want the mechanisms, the selection tables and the real incident numbers? → switch to the deep read
This chapter inverts the problem: data integrity is the means, data availability is the goal — users don't care how many replicas you hold or whether your checksums match, only whether the correct data is there when they need it. The things that can destroy it come in 24 combinations, and no single measure covers them, so Google's answer is defense in depth with three lines: soft deletion, backups and restores, and out-of-band validation. The two lines that sting most: replication is not recoverability, and a backup whose restore was never verified is not a backup.
Chapter 26 of the SRE book, in the data-reliability cluster of Part III (Practices), right after Chapter 25 on data processing pipelines — fittingly, since pipelines are one of the leading ways data gets destroyed in bulk. The authors, Raymond Blum and Rhandeep Singh, spent years on Gmail and Google Drive, systems where losing one item counts as an incident. In the real world it maps to anything that holds user data for a long time: mail, cloud storage, SaaS, payment ledgers, warehouses.
Everyone knows how to write an availability SLO: 99.9% of requests succeed. But here is the awkward question: if the request succeeded and the response was empty, was that available? A system that has just emptied a user's mailbox can show green across the dashboard — latency normal, error rate zero. Availability metrics measure whether the service is up, not whether the data is right.
Traditional operations answers this with "we have backups". The chapter exists to expose the three holes in that sentence: the backup may never have been verified (when GitLab lost its primary in 2017, none of the 5 backup and replication techniques it had deployed actually worked); the backup may not keep up with the damage (of the roughly 600,000 audio tracks Google Music deleted by mistake in 2012, some 161,000 were gone before they were ever backed up); and nobody may notice at all, so that by the time you look, every generation inside the retention window is already poisoned.
The cloud amplifies all three at once: high update rates, continuous delivery changing code daily, services calling services, users who expect 24×7 with no maintenance window, and data that accretes for a decade or more. The cost of not solving it isn't "slower". It's the user's things are gone, permanently.
The textbook definition — data stays accurate and consistent over its lifetime — is useless for engineering, because it never tells you how much is enough or what to spend. This chapter swaps the yardstick for data availability from the user's point of view: can the service put the correct data in the user's hands when they need it? Two consequences follow immediately:
So the SLO should read "data is correctly readable at all times, and any corruption event is recovered within X hours", not "we back up nightly". And scale turns small probabilities into daily work: a system holding 10 billion objects, each with a one-in-a-million annual chance of silent corruption, still produces about 10,000 bad objects a year for someone to deal with.
The book decomposes "how data goes bad" along three orthogonal axes:
Multiplied out: 6 × 2 × 2 = 24 combinations. The insight isn't the number, it's that every single defense covers only a few cells. Replicas cover hardware and site disasters, soft deletion covers accidental deletes, backups cover bulk corruption — but backups do not cover creeping loss: by the time you notice, the bad data has been copied into every generation inside the retention window. The only thing that covers that cell is noticing early. Which is why the answer has to be defense in depth, not "buy a better backup product".
The mechanism is plain: a delete request doesn't delete. It stamps the record "deleted" with a timestamp, reads filter it out, and real removal happens when the window expires. What users see is a trash can and revision history.
Why does it rank first? Because it catches the most frequent class of incident: accidental user deletes, malicious wipes after an account hijack, one ops script run against the wrong target. These are far more common than a data center burning down, and recovery costs essentially nothing — flip a flag, done in seconds, orders of magnitude faster than dredging a backup. On frequency × cost-to-recover, this is the highest-return layer you can build.
Two engineering details. Window length is a genuine trade-off: too short and you can't save people (users often notice days later), too long and you pay storage while colliding head-on with the demand for real deletion; the common industry answer is weeks (Gmail's 30-day trash is exactly this thinking). And lazy deletion: actually scrubbing data out of every replica, cache, index and backup can take weeks to converge at scale — meaning deletion is inherently a process, not an instant.
Be clear about what it does not cover: soft deletion handles deletion. It does nothing about data being mangled — an app bug that miscomputes a field and writes a dirty value leaves nothing in the trash can.
This is the heart of the chapter, and it has three counterintuitive points.
(1) Replication is not backup. The book is blunt: "Replication and redundancy are not recoverability." A database that auto-syncs replicas guarantees that one bad delete or one corrupted row is pushed to every copy, usually before you can react. Put the magnitudes side by side and it's obvious: replication propagates in milliseconds to seconds, while humans notice in minutes to days. That gap of several orders of magnitude is the whole reason replicas cannot save you.
(2) A backup is not an archive. The book's test is a single question: can it be loaded back into the application? In its own words, "the most important difference between backups and archives is that backups can be loaded back into an application, while archives cannot." Backups exist so you can load and keep running, so format, schema and dependency versions must line up with the current system; archives exist for compliance and audit and may simply not go back in. Mistaking one for the other is a fixture of incident reviews.
(3) Derive the backup strategy from the recovery requirement. Don't start with "how often do we back up". Start with three questions: how much data can we lose (RPO) → sets frequency and whether you replay transaction logs; how long can we be down (RTO) → sets medium and location; which of the 24 cells must this cover → sets isolation. A snapshot inside the same cluster cannot survive "the delete was synced over", so there has to be a copy that is offline, heterogeneous, and remote. Google's choice at this layer was tape — absurdly slow, but physically disconnected from the live system, so no online mistake can reach it. That is what saved Gmail in 2011.
Be honest about cost: full backups are simplest but storage and time grow linearly with the data; incrementals and differentials save space but restores must be replayed in order, and the longer the chain, the more likely it breaks. Real systems land on "periodic full + incrementals + keep N generations", and how many generations is decided by how late you might plausibly notice corruption — which walks you right back to the creeping-loss cell.
The first two lines are both after the fact: they let you get data back, provided you know it went bad. The third line exists purely for the knowing. You run a set of validators independent of the main service that continuously reconcile the data — are references dangling (does this track's metadata still point at real audio?), do cross-store ledgers balance, do replicas agree, do business invariants hold?
Why it must exist: the faster and more automated the system, the less time it takes to finish propagating the damage — while the time humans take to notice has not improved at all. A validator's value is compressing detection latency from "wait for a user to complain" (days) to "the next validation pass" (minutes to hours) — which decides whether a clean backup still exists inside the retention window. Google Music is the cautionary case: the problem surfaced only because an engineer investigated one track that wouldn't play, and by then roughly 161,000 tracks were past saving.
Three practice notes: it must be out of band — an independent read path and deployment, never sharing the possibly-buggy code of the system under test, or the same bug fools service and validator alike; the validator itself must be monitored — one that silently stopped is worse than none, because it supplies false confidence; and alerts must be actionable — "N records don't reconcile" is useless, you need which records and since which version.
The step most often skipped: assume any recovery procedure that has not been rehearsed is broken. SRE treats recovery as a product feature under continuous test — periodic end-to-end exercises (Google's DiRT disaster recovery testing is exactly this idea) whose acceptance criterion is "the data was genuinely loaded back into the application and business validation passed", not "the backup job returned success". The chapter ties this back to a few general SRE principles: beginner's mind (don't assume, go look), trust but verify, hope is not a strategy, and defense in depth itself.
Table 1 · The three lines: what each catches, how fast, at what cost
| Line 1 · Soft deletion | Line 2 · Backups & restores | Line 3 · Out-of-band validation | |
|---|---|---|---|
| Mainly catches | User deletes, hijack wipes, a script run against the wrong target | App bugs shredding data in bulk, site disasters, media failure | Nothing — its job is early detection |
| Recovery speed | Seconds (flip a flag) | Hours to days (medium and bandwidth bound) | Produces no recovery ability |
| Frequency covered | The most common incidents by far | Rarer, but far more destructive | Covers the creeping-loss cell nothing else reaches |
| Main cost | Storage; collides with real-deletion privacy demands | Storage plus rehearsal effort; business hurt during recovery | Continuous compute; the validator itself needs monitoring |
| Doesn't cover | Data being mangled rather than deleted; paths that bypass the layer | Creeping loss — every retained generation is already poisoned | It gets back exactly zero bytes |
Table 2 · Replication / backup / archive: three things routinely conflated
| Replication | Backup | Archive | |
|---|---|---|---|
| Exists for | Serving reads and writes when a machine or site dies | Being able to load data back and keep running | Compliance and audit, sealed long-term |
| Loads back in? | N/A — it is already live | Yes — that is its definition | Usually not |
| Facing a bad delete | Syncs the delete in milliseconds; an accomplice | Gets it back, inside the retention window | May hold the content but can't put it back |
| Latency / isolation | Milliseconds to seconds, zero isolation | Hours to days; needs offline / remote / heterogeneous | Days to weeks, strong isolation |
| Classic misuse | Treating multi-AZ as a backup | Monitoring backup success, never verifying restore | Using an archive as a backup, discovering too late |
Table 3 · Choosing medium and location (derived from the recovery requirement)
| Option | Typical RTO | Isolation | Cost | When to pick it |
|---|---|---|---|---|
| Same-cluster snapshot | Minutes | Low — a bad or malicious delete can take it too | Low | As the fastest layer, alongside soft deletion; never as the only line |
| Remote object storage (versioning / object lock) | Hours | Medium-high — cross-region, and can be made immutable | Medium | Most teams' main answer today; restore is bandwidth bound |
| Offline tape | A day or more | Highest — physically disconnected | Cheapest per byte, slowest to fetch | The last line; it is what brought Gmail back |
| Continuous log / WAL replay | Depends on replay volume | Depends where the log lives | Medium-high | When RPO must be minutes and replay time is acceptable |
Do the arithmetic on recovery: RTO is often physics, not policy. Pulling 100 TB back from a remote region at a saturated 10 Gbps takes roughly 22 hours. If your RTO says "4 hours", no amount of extra storage spend fixes that — the architecture has to change (parallel per-shard restore, a nearer copy, hot data first). An RTO nobody has done the arithmetic on is a wish.
This chapter is required reading for data systems because it turns a platitude everybody can say — "we have backups" — into an auditable checklist: how many days is the soft-delete window? When was the last full restore rehearsal, and how long did it take? Which invariants do the validators cover, and when did they last complete a successful pass? That framing is now everywhere in the industry: object storage versioning and object lock are essentially "soft deletion plus a tamper-proof backup", warehouse time travel is soft deletion in another guise, data observability products are the commercialisation of the third line, and restore rehearsals are a hard compliance requirement for banks and cloud providers. In an architecture review or an interview it hands you three sentences that cut straight through: multi-AZ is not a backup, backup success rate is not restore success rate, and an unmonitored validator is no validator at all.
0.02% of Gmail users looking at empty mailboxes, and Google restored the mail from tape — confirming that the last line has to be offline and heterogeneous: however many online replicas you hold, they went down together. Google SRE Book, Ch.26 Data Integrity ↗600,000 audio tracks; only 436,223 were recovered from tape, and about 161,000 were gone before they had ever been backed up — evidence that detecting early beats backing up more. The problem surfaced only because an engineer chased down one track that wouldn't play. Google SRE Book, Ch.26 Data Integrity ↗5 deployed backup and replication techniques worked (S3 uploads failing silently, a pg_dump version mismatch, misconfigured notification mail); about 6 hours of data went with it, including roughly 5,000 projects and 700 new accounts — the most brutal possible confirmation that an unverified backup is not a backup. GitLab, "Postmortem of database outage of January 31", 2017 ↗43-second network partition triggered automated failover, both coasts accepted writes and the databases diverged; reconciling them took 24 hours and 11 minutes of degraded service — confirming that replication buys availability, not data correctness. GitHub Blog, "October 21 post-incident analysis", 2018 ↗1. In one line: data integrity is the means, data availability is the goal — users care only whether the correct data is there when they need it.
2. Availability SLOs cannot see data problems: a system that just emptied a mailbox shows all green, and recovery time is part of availability.
3. Failure modes = root cause (6) × scope (2) × rate (2) = 24 combinations; no silver bullet, only defense in depth. The hardest cell is creeping loss, which backups cannot cover and only early detection can.
4. Line one, soft deletion: catches the highest-frequency deletes and hijack wipes, recovers in seconds; window length versus privacy is a real trade-off; it does nothing about mangled data.
5. Line two, backups and restores: replication and redundancy are not recoverability; backups load back into the application, archives don't; derive strategy from RPO/RTO — Google chose tape precisely because it is disconnected.
6. Line three, out-of-band validation: prevents nothing, but compresses detection from days to minutes; must be independently deployed, monitored itself, and alert actionably.
7. An unrehearsed recovery procedure is broken by default: acceptance is "loaded back into the application, business validation passed", not "the backup job succeeded".
8. RTO is usually physics: 100 TB at a saturated 10 Gbps is about 22 hours — an RTO with no arithmetic behind it is a wish.
9. Three numbers worth carrying: Gmail 2011 recovered from tape for 0.02% of users; Google Music 2012 lost about 161,000 tracks before they were ever backed up; GitLab 2017 had 5 backup techniques and none of them worked.
10. Three questions that end an architecture review: multi-AZ is not a backup, backup success is not restore success, and when did you last do a full restore rehearsal?