Distributed systemsvector clockdotted version vectorsiblings

Version vector

Definition

A version vector maps each replica to the number of updates it has applied to an item; comparing two vectors tells whether one version descends from the other or whether they conflict.

In practice

In leaderless and multi-leader stores, two clients can update the same key on different replicas. If every counter in vector X is at least the matching counter in Y, X is newer and Y can be dropped. If each vector is ahead somewhere, the writes were concurrent, and the store keeps both as siblings for a merge instead of silently losing one.

Version vectors detect conflicts but do not resolve them: the application or a CRDT must merge the siblings. Vectors grow with the number of writers, so systems bound them with per-replica (not per-client) entries or pruning. They are the main alternative to last-write-wins when no write may be lost.

Example

A cart has vector {A:2, B:1}; one client adds a book through replica A ({A:3, B:1}) while another adds a pen through B ({A:2, B:2}). Neither dominates, so the next read returns both carts to be merged.