A backup captures an earlier data state. Restoring it can revive records deleted after that snapshot unless deletion decisions are preserved separately and replayed during recovery. A tombstone records that a scoped object must remain unavailable, with an operation generation or sequence that can be compared against restored data. The restore plan must account for primary rows, indexes, files, and queued change events. Backups also have their own expiry schedule; deleting a live record does not imply every historical backup block vanishes immediately. The application must describe the approved policy accurately and restrict backup access while it ages out.
Backup Restore with Deletion Tombstones
Working case
A nightly snapshot contains case 47. The next day an erasure operation removes it from active stores and records deletion generation 8. Two days later an outage requires restoring the old snapshot. Without the tombstone, case 47 reappears in the database, and an index rebuild makes it searchable. The recovery process imports the snapshot into a controlled environment, applies all later deletion markers before serving users, then rebuilds derived stores only from permitted records. A smoke check confirms case 47 remains inaccessible while case 62, which was not deleted, is restored.
Implementation boundary
function mayRestore(recordGeneration, deletionGeneration) {
return deletionGeneration === undefined || recordGeneration > deletionGeneration;
}
console.log(mayRestore(6, 8));
// Output: falseThe numeric helper expresses ordering, not a complete restore protocol. Keep deletion markers in a recoverable store whose retention outlives any backup that may contain the record. Bind markers to tenant and stable object identity; recycled IDs must not confuse them. During restore, do not reopen traffic until the snapshot, later writes, and deletion markers are reconciled. Rebuild search and media indexes from the reconciled state, and validate queued events do not recreate deleted rows. Test a single-tenant recovery separately from a global restore, because shared backups may require selective recovery without exposing other tenant data.
Cost and boundaries
Replaying d deletion markers after a restore is O(d) work plus verification across k derived stores. Holding markers longer than the oldest relevant backup consumes storage but is usually far smaller than retaining full deleted content. A restore into a separate environment adds temporary storage and time, yet permits checks before users see the data. Rebuilding large indexes may dominate recovery time. Measure recovery point, recovery time, marker replay duration, and post-restore unauthorized hits; a successful database boot is not enough evidence.
Failure trace
The team restores a clean-looking database snapshot from Monday and turns traffic on immediately. Case 47, deleted Tuesday, becomes visible again on Thursday, while a queued index event republishes its title. A restore plan without deletion replay has violated the active deletion decision. Keep a marker ledger and test it in drills. Another failure deletes the markers after thirty days while backups remain available for ninety; a late restore then has no memory of removed records. Align marker and backup lifetimes under the approved policy.
Verification
- A restored snapshot cannot re-expose a later-deleted record.
- Marker retention covers every backup that may contain the record.
- Index and queue replay honor deletion generations.
Practice drill
Take a backup containing cases 47 and 62. Delete case 47, create marker generation 8, then restore the old snapshot into an isolated environment. Apply the markers, rebuild the index, and test both cases before opening traffic. Delay an old add event until after rebuild and ensure it cannot revive case 47. Try a tenant-6-only restore from a shared backup and check that tenant 9 remains inaccessible. Verify marker retention covers the oldest backup that could contain the deleted record.
Decision note
Reconcile deletion markers before restored data or derived indexes become readable.
Common Mistakes
- Treating backup restore as a simple database replacement.
- Expiring tombstones before old backups expire.
- Opening traffic before rebuilt indexes and deletions are checked.
Connected lessons
Data Retention, Export, and Erasure; Retention Inventory and Expiry Workflows; Export and Erasure Job State; Browser Storage Cleanup on Account Change; Backup and Restore Drills; Expand-and-Contract Schema Migrations; Retention Inventory and Expiry Workflows.
Apply and check
Build Project: verified data expiry and review Web Development: authorization and data lifecycle decisions quiz.
