What is the dual-write problem?
Sketch your own answer first, then compare it with the one below.
A strong answer
A service must update its database and also publish an event. These are two calls to two systems with no shared transaction. If the service crashes between them, one happened and the other did not.
If it writes the row and then crashes, the event is lost, and no one downstream hears about the order. If it publishes first and then fails to write, the event describes something that never happened. Retrying does not fix it, because the service no longer knows what it finished.
Sources
- Chris Richardson (2018). Pattern: Transactional outbox.
- Martin Kleppmann (2017). Designing Data-Intensive Applications.