Video in progress

If a user says "delete my data completely", how do you do it across dozens of services, caches, backups and analytical databases?

Each service declares where personal data lives and subscribes to a central "erasure" event; the process collects a confirmation from every service. In immutable places (event log, backups) I encrypt the data with a per-user key and make it unreadable by deleting the key.

📖 Answer

In a monolith this was a single DELETE. In a distributed system, personal data sits in the databases of 30 services, in Kafka topics, in Elasticsearch, in ClickHouse, in logs and in 90-day backups. Many teams don't know exactly where what is, and that's the first problem.

I split it into several parts:

  1. A data map. Each service marks in its own schema which fields are personal (for example, with an annotation or a catalog). Without this, no process will be complete.

  2. An erasure orchestrator. A request comes in → a UserErasureRequested event → each service deletes its own part and returns ErasureCompleted(service). The orchestrator waits against a checklist, tracks the deadline (say, 30 days) and escalates the ones that don't respond. It resembles a saga, only without compensation.

  3. Anonymization instead of deletion. Tax law may require you to keep order and payment records. In them the personal fields are replaced, and the amount and date remain. You agree this with lawyers up front.

  4. Crypto-shredding. For immutable places: the event store, long retention in Kafka, backups. Personal fields are encrypted with a user-specific key, and the keys live in a separate KMS. When the key is deleted, every copy becomes unreadable at once, and there's no need to rewrite the backups.

  5. Analytics and logs. In analytics, a pseudonym instead of the user ID; if the row in the mapping table is deleted, the link is cut. In logs, don't write personal data at all, and mask it at the log formatter level.

A data residency requirement is close to this: if the data of citizens of a certain country has to stay in that country, routing and storage are split by region, and only aggregated or anonymous data goes out to global analytics.