<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Data Repair on SRE Engineering Practice</title><link>https://www.sre.wang/en/tags/data-repair/</link><description>Recent content in Data Repair on SRE Engineering Practice</description><image><title>SRE Engineering Practice</title><url>https://www.sre.wang/share-card-square.jpg</url><link>https://www.sre.wang/share-card-square.jpg</link></image><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Tue, 17 Nov 2026 00:33:02 +0800</lastBuildDate><atom:link href="https://www.sre.wang/en/tags/data-repair/index.xml" rel="self" type="application/rss+xml"/><item><title>38,412 Orders Corrupted by a Correction Script: 5 Defense Layers and 7 Traps in Production Data Repair</title><link>https://www.sre.wang/en/posts/sre-production-data-repair-guardrails/</link><pubDate>Tue, 17 Nov 2026 00:33:02 +0800</pubDate><guid>https://www.sre.wang/en/posts/sre-production-data-repair-guardrails/</guid><description>At 0:47 a.m. a payment reconciliation alert reported 37,904 orders out of sync with their payment records. The cause: a status-correction script connected to the `order_read` alias, which after that night&amp;#39;s read/write split change pointed at the primary, and a WHERE clause loose enough to flip 38,412 orders to `cancelled` in four minutes. Fixing them took three hours and twelve minutes, of which the actual writes were 101 seconds. This article turns that night into practice: five defense layers for production data repair. L1 makes a repair an auditable change request whose dry-run emits a diffable file. L2 replays facts from binlog before images instead of overwriting values from memory. L3 makes the runner idempotent, resumable and interruptible via a ledger table and primary-key cursors. L4 gives the script circuit breakers on affected rows, replica lag and a kill switch. L5 keeps a row-level audit trail you can replay by key and prove was not edited afterwards. You get a copyable Go repairer skeleton, measured batch-size trade-offs, ledger DDL and self-check SQL, and seven traps ordered by what they cost us, plus a twelve-item pre-flight checklist.</description></item></channel></rss>