Dual Writes Diverge — and the Ordered-Log Fix

Dual Writes Diverge — and the Ordered-Log Fix A sequence diagram generated by Archify. write x=1 database order #1: A is applied first write x=2 index order #1: B is applied first write x=2 database order #2: the database ends at x=2 write x=1 index order #2: the index ends at x=1 DB x=2 ≠ index x=1 stores are permanently inconsistent — neither is in charge of the order (Figure 12-4) write x=1 all user input is funneled through one system write x=2 the database decides one total order for all writes CDC: change log changes are captured in commit order: x=1, then x=2 apply in same total order derived updates are deterministic + idempotent → easy recovery consistent: x=2 whether CDC or event sourcing matters less than deciding on a total order 1 · Two clients, two stores, no ordering authority 2 · One ordering authority — a single total order client A · concurrent writer · Sequence participant client A concurrent writer client B · concurrent writer · Sequence participant client B concurrent writer database · system of record · Sequence participant database system of record event log · CDC / change log · Sequence participant event log CDC / change log search index · derived data · Sequence participant search index derived data Legend main request return async trace