vector clock pattern
Each node keeps its own counter; every event includes the snapshot of all counters known at that moment. Comparing vectors tells you whether two events were causally related, concurrent, or one preceded the other.
Each node keeps its own counter; every event includes the snapshot of all counters known at that moment. Comparing vectors tells you whether two events were causally related, concurrent, or one preceded the other.
symptoms
- lost updates from concurrent writes
- can't tell which conflicting write 'should win'
causes
- physical clocks don't capture causality
- concurrent writes need conflict resolution
fixes
- vector clocks / version vectors per replica
- CRDTs for automatic conflict resolution
- last-write-wins only when causality doesn't matter
you might say
- vector clock
- version vector
- happens-before