Skip to content

Cache: LWW convergence with timestamp ordering - part 2#11

Merged
bricke merged 3 commits into
mainfrom
lww-cache-convergence
Mar 26, 2026
Merged

Cache: LWW convergence with timestamp ordering - part 2#11
bricke merged 3 commits into
mainfrom
lww-cache-convergence

Conversation

@bricke
Copy link
Copy Markdown
Owner

@bricke bricke commented Mar 26, 2026

Summary

  • Discard stale updates in Cache::set — if the existing entry has a newer timestamp, the incoming write is ignored
  • Deterministic tiebreaker on equal timestamps using lexicographic publisher name comparison
  • Guarantees all nodes converge to the same value regardless of message arrival order (LWW-Register)

Context

Multiple processes can legitimately write the same path (e.g. battery monitor, light sensor, and user process all adjusting display.backlight). Without ordering, caches on different subscribers could diverge depending on message arrival order.

Test plan

  • stale update is discarded — older timestamp doesn't overwrite newer
  • equal timestamp breaks tie by publisher name — both arrival orders converge to same result
  • All existing cache tests still pass (9 cases, 30 assertions)

bricke added 3 commits March 25, 2026 21:38
When multiple processes write the same path, all nodes now converge to
the same value regardless of message arrival order. Uses timestamp as
primary ordering and publisher name as deterministic tiebreaker.
@bricke bricke merged commit 718d74f into main Mar 26, 2026
4 checks passed
@bricke bricke deleted the lww-cache-convergence branch March 27, 2026 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant