Sync / Editing server data
Failure modes and recovery
- Offline edits: Pending edits stay in the outbox across reloads and flush on reconnect.
- Table write lag or failure: Committed edits keep showing on screen while
revisionlags; the next exchange retriessettle, andabsorbwaits until recovery succeeds. - Duplicate write after a crash:
applyEditschecksrevision <= at, making repeated application harmless. - Refused edit or forged stamp:
validateandauthorizereject bad operations or client-supplied stamps before commit; the sender drops the rejected edit and marks its cells. - Missing row: Validate row existence before committing in the journal so edits to missing rows fail visibly rather than vanishing after recovery.
- Server reset: When a journal starts a fresh epoch,
onReinstallfires withreset, clears held overlays, and refreshes cached rows. Reset the SQL table alongside the journal:settlerefuses to run (TableAheadOfJournalError) whenevertableRevisionexceeds the journal's cursor. - Sorted lists: An unabsorbed edit updates the cell value in place until the next query re-sorts rows on the server.
- Recovery cursor: In persistent deployments, recovery replays from the journal floor after a restart, while the effect ledger prevents duplicate side effects within an epoch.
Limits and when to use simpler tools
- Cell values are last-writer-wins by commit order; use CRDT-backed documents for collaborative rich text.
- The journal and the SQL table must be kept or reset together.
- If the dataset fits comfortably in memory on every client, use a plain Sync slice.
- If edits only happen online, use a Remote mutation.
Next
- Learn how Sync's durable log works in Replicated state.
- See how Remote caches and overlays server data in Server-derived state.
- Explore the full 100,000-row app in
examples/registry.