Event Order and Versions of a Record

Services can receive events in a different order from the changes they describe. A version rule can help a consumer choose which update to apply.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a late delivery
  2. Name ordering scope
  3. Compare arrival order with the authoritative revision
  4. Distinguish snapshots from required incremental operations

Trace a late delivery

Updates produce versions four and five. An index consumer receives five, then four. Replacing the indexed value by every arrival would restore older content. Version-checked writes show the value of stored version checks.

Name ordering scope

A version for one record need not order work on other records. Choose the relevant identity and ordering relation. See ordering events.[1]

Compare arrival order with the authoritative revision

A service emits revisions eight and nine for one item. A consumer receives nine first, then eight. If the events carry full snapshots and the consumer keeps the greatest applied revision, the later stale delivery cannot regress the item. See event sequences.

Receive snapshot v9 → apply v9
Receive snapshot v8 → ignore as older under rule
Receive v9 again → duplicate
Stored state remains v9

Distinguish snapshots from required incremental operations

If each event carries a delta that depends on earlier deltas, discarding older versions can lose effects. Use sequence tracking or reconciliation suitable to that contract. Test reversed and repeated deliveries.

References

  1. Google, Site Reliability Engineering ↩