Video in progress
A user asked to delete their data, and the data is spread across 15 services, Kafka topics, caches, backups and logs. How do you design this?
First you need to know where personal data is: a PII map in the service catalog. Then the deletion request is broadcast as an event, each service deletes or anonymizes its part and returns a confirmation, and a central orchestrator tracks the deadline and status. For immutable places (Kafka, backups) you use crypto-shredding.
📖 Answer
This is first of all an inventory problem. If there is no answer to "where do we have a customer's phone number?", no architecture will help. So every service declares in the catalog which PII fields it stores, for how long and on what legal basis.
The deletion flow:
privacy-serviceaccepts the request, verifies the person and emits anErasureRequested{subjectId, requestId, deadline}event.- Each service does its part and sends
ErasureCompleted{service, requestId}. The orchestrator sees who hasn't answered and escalates as the deadline approaches. - You can't delete everything: accounting and tax laws require payment records to be kept for years. In such places the data is anonymized (name and phone are erased, amount and date stay) or restricted with a legal-retention flag. This decision is made with lawyers, service by service.
Immutable places:
- Kafka. In a compacted topic you can send a tombstone by key, but you can't delete a single message from a topic with ordinary retention. The first solution is to keep PII out of events (only a
customerId). The second is crypto-shredding: each user's PII is encrypted with their own key, with the keys in a KMS. Deleting the key makes every copy in Kafka, backups and the DWH unreadable. - Backups. Rewriting them is impractical. Usually backups expire on their own schedule, and if you restore one, the deletion list is applied again, so you keep a "deleted" journal made up of IDs only.
- Logs and traces: they shouldn't contain PII, and if they do, a short retention period.
- Caches and search indexes: they subscribe to the deletion event too.
- External providers (CRM, email service): they also get a deletion request through their API, with the result recorded.
Verification: an automated test that creates a test user, sends a deletion request, then searches for them in all services and the DWH. Without it, the claim that "every service deletes" stays unproven.
The cheapest road, though, is to spread PII less. Many services need only the ID, not the customer's name.
Sign up to mark studied questions and save your progress.