Course map

Topic 081 / Core

Data lifecycle: source of truth, retention, archival, deletion, integrity constraints, reconciliation

Chapter 5.6 · Operational Storage and the Data Lifecycle

What and why

Every piece of data needs exactly one authoritative home — its source of truth — with every cache, denormalized column, search index, and replica treated as a derived copy. The data lifecycle names that authority explicitly and governs every copy through retention, archival, deletion, and periodic reconciliation, so drift is caught instead of discovered by a customer. Builds on: → 63 (normalization and denormalization).

Diagram

Data category Source of truth Derived copies Retention Reconciliation
Order ledger ledger table reporting cache, search index per policy vs. payment provider totals
Product catalog catalog table denormalized order_item.product_name (→ 63) per policy spot-check on write path
Inventory count ledger of movements displayed cache count short TTL nightly vs. ledger

How it works

  1. Name the source of truth for every data category explicitly — exactly one system is authoritative; everything else is derived.
  2. Set a retention rule per category (how long it's kept) and an archival path for data past active use but not yet deletable.
  3. Implement deletion that actually deletes — including every derived copy (cache entries, search indexes, backups within their window, logs). A "delete" that leaves data in five other places isn't one.
  4. Enforce integrity constraints at the source of truth (foreign keys, check constraints, application invariants) so derived copies can't drift into an impossible state at the root.
  5. Run reconciliation periodically: compare systems that must agree (inventory count vs. ledger vs. a provider's report) and alert on mismatches — derived copies will eventually drift; reconciliation is how that's caught before a customer notices.

Practical example

(illustrative). An inventory count cached for display drifts from the ledger-derived true count after a missed event. A nightly reconciliation job compares the cached count against the source-of-truth ledger, corrects the drift, and raises an alert if the mismatch exceeds a stated threshold.

When to use it

  • Use when: any production system with more than one copy of the same fact — especially anything touching money, inventory, or data subject to deletion requests.
  • Avoid when: a genuinely tiny system with one database and no caches or replicas — the lifecycle shrinks to just retention and deletion, with nothing to reconcile.
  • Failure scenarios: a user deletion request that removes the database row but leaves the record in a cache, a search index, and an old backup — not actually deleted; two systems silently diverging for months because nothing ever compared them.
  • Simpler alternative: for a single-store system, the lifecycle is nearly trivial — the database row is the only copy.

Practice

(20 min, no lab needed). For the catalog-plus-orders schema from topic 63, write out the source of truth, retention rule, and deletion path for three categories: orders, catalog entries, and access logs. Then design a reconciliation check between the order ledger and a hypothetical payment provider's reported totals — what's compared, how often, and what happens on a mismatch. Done when the retention plan has a line per data class and the reconciliation check names its comparison, cadence, and action.

Key takeaway

Name the source of truth for every copy, and reconcile on a schedule — drift is normal, going undetected is the failure. Done when you can: write a one-line lifecycle statement (source, retention, deletion, reconciliation) for any data category in a system. Used next in → Projects 7, 8, 9; disaster recovery → 195.

References

None — this topic makes no external claims.

Source directory

Search the guide