yeti labs

field note 018 · 2026-10-15 · backups, disaster recovery

every backup succeeded for 23 days, and none of them left the box

we run infrastructure for a blockchain data-indexing company. in august we found that its off-box database backups had been failing for three weeks while every check said they were fine. this is the whole arc: the silent failure, the fix, a rebuild drill on a throwaway server, and where the recovery point sits now.

reported success
23 days
dailies gone for good
8
drill rebuild
~8.5 min
recovery point now
~30s

how a backup fails quietly

the database box runs postgres and mongodb. five backup scripts copied the nightly postgres dumps and other backups to a google cloud storage bucket. we found the problem on 2026-08-12, by accident, while setting up a different credential for the weekly healthcheck.

all five scripts uploaded as a person. the copy ran under a user login, and google forces user logins to re-authenticate every so often. a cron job can't answer that prompt, so from about 2026-07-20 every upload failed with a reauth error. three things then lined up:

  • the error went to /dev/null, so nothing was written down anywhere.
  • the script exited 0 regardless, so the dead-man's switch kept getting its "done" ping and stayed green.
  • local retention was 14 days, so the oldest local dumps were aging out while nobody had a reason to look.

mongodb was fine the whole time. its backups (Percona Backup for MongoDB, continuous point-in-time) already used a service account, writing to the same bucket. the missing control was sitting right next to the broken one.

what it cost

postgres had no off-box copy for 23 days. by the time we looked, the 14-day local retention had already deleted the dailies from 07-21 through 07-28, so those 8 days are gone. the 15 dumps that were still on disk (07-29 to 08-12, ~12 GB) backfilled in about 40 seconds once the credential worked.

the fix

long story short, backups stopped running as a person. we made a dedicated service account that can create and read objects in the bucket and can't delete them. a compromised database box can add backups and can't destroy the ones already off it. we tested both directions: an upload worked, a delete was denied.

two small surprises on the way. create-only on its own fails, because the copy command checks whether the object exists first, which needs read. and append-only means nothing can be overwritten, so a "latest" file had to become a timestamped one (the bucket's existing 30-day lifecycle rule prunes the old ones).

all five scripts now go through one upload helper that keeps stderr, exits non-zero, and logs a loud "backup degraded, off-box copy missing" line with the error. then we pointed the healthcheck at the bucket itself, and on day one it would have reported three of its four backup checks as dead when they were fine (wrong prefixes, and postgres dumps sitting at the bucket root where a plain prefix lists zero objects). the check needed checking too.

the drill

a backup you've never restored is a guess. on 2026-10-14 we rented an hourly bare-metal server (about $1.09 an hour), rebuilt the whole box onto it from the off-box copies, compared it against production, and deleted it. start to finish took 14 minutes.

steptime
main database restore (16 parallel jobs)169s
platform database restore24s
time-series core restore13s
box ready to 13 of 13 processes online~8.5 min
read routes matching production8 of 8

a second copy of production can do real damage if it starts talking to the world, so we cut it off before starting a single app: no tunnel, no VPN, no crons, and a firewall dropping all outbound traffic except our own connection. that firewall earned its keep inside the hour. it caught a write heading to a hosted postgres outside the box, which we traced the next day to an old database the config still pointed at (since deleted).

the drill wrote down 9 gaps. the big one was that the tunnel credentials and the VPN key weren't in the config archive, so the rebuilt box could serve nothing until someone recreated them by hand. that was fixed the same night, and the realistic time to serving traffic is now about 10 to 12 minutes. the gap that mattered most to the client was the other one: the restore came back 2,194 customer filters short, because the best postgres copy was still a nightly dump.

the recovery point went from weeks to seconds

most data the database box could lose if it died, log scale (each gridline is 1 s, 1 min, 1 hr, 1 day, 30 days)

1 s1 min1 hr1 day30 daysbackups dead, aug23 daysfixed, nightly dump~1 daywal stream, oct~30 spartial wal pushed every 30 s,about $14 a month in storage
source: yeti labs incident notes, drill log, and wal-stream build notes, aug to oct 2026yeti labs · field note 018

getting to ~30 seconds

the ask after the drill was to "try to get to 0 data loss." so on 2026-10-15 postgres started streaming its write-ahead log (the running record of every change) off the box continuously. pg_receivewal reads it through a replication slot, a small pusher compresses it with zstd (about 2:1 on ~49 MB a minute raw) and uploads it with the same append-only service account. finished segments go up as they close, and the in-progress segment goes up as a partial every 30 seconds. a full base backup runs weekly, so a restore is the last base plus the log replayed on top.

the details that keep it from biting back:

  • disk: a dead stream holds log on the box, so the slot is capped at 150 GB of retained log and can't fill the disk.
  • cost: 10-second partials were on the table, and we picked 30 for cost. moving the log to its own bucket with soft delete off (plus the 30-second partials) took it from about $28 a month to about $14 at ~48 GB a day.
  • alerts: a watchdog on a different machine checks the bucket every 5 minutes and pings once per episode (and once on recovery), so a stalled stream can't go quiet the way the dumps did.
  • config: the config archive now re-runs about 30 seconds after any captured config or secret file changes, so the next rebuild has the tunnel and VPN keys it was missing.

the same day we rehearsed the scripted rebuild on another throwaway server: about 4 minutes of script time including a 112-second point-in-time restore, 15 of 15 processes up, 8 of 8 routes matching, and the box gone again in 9 minutes.

true zero would need synchronous replication, which blocks every production commit whenever the replica is down. for this box ~30 seconds is the right trade. the cutover step of the scripted rebuild also hasn't been rehearsed, because by design it touches production.

what we'd do instead

  1. never run unattended jobs as a person. a user login will eventually ask a question cron can't answer, so give every backup its own service account from day one, append-only.
  2. make the dead-man's switch check the artifact. "the script ran" is a weaker signal than "today's object is in the bucket and it's the right size."
  3. keep local retention longer than the time it takes you to notice. ours was 14 days, the outage ran 23, and 8 dailies aged out before anyone looked.
  4. restore on a cut-off box before you need to. the drill cost about a dollar and found 9 gaps, including one that would have left a rebuilt box unable to serve anything.
got backups you've never restored?

we'll rebuild from them on a throwaway box and tell you what's missing.

talk to the agent →