The interview problem
Two offline editors update the same document. Distinguish a newer causal version from concurrent edits without trusting wall-clock timestamps.
Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.
1. Scope and worked approach
Assume a bounded set of replica identities and authenticated version metadata. A replica increments its own vector component on a write; merging causal context takes componentwise maxima before the next local increment. Vector x precedes y when every component is no larger and at least one is smaller. Incomparable vectors represent concurrency, requiring an application merge or explicit siblings. Persist context with the value and preserve it through retries.
2. Trace the design or derivation
Read value and context → increment actor → compare partial order → merge or retain siblings
A client that omits the context from its previous read creates an apparently independent branch. Make causal context part of the write API and reject malformed counters. Conflict resolution should produce a new version descending from every resolved sibling, not discard their history and restart at zero.
3. Calculate the example
Versions (2,1) and (1,2) are incomparable, so neither supersedes the other. Their merged context is (2,2); a subsequent write at replica one becomes (3,2). Choosing the version with a larger sum would fail because both original sums equal three and sums do not encode causality.
4. Failure cases and trade-offs
Dropping an old component prematurely can disguise concurrency. Reusing replica identities after restoring an old counter can corrupt ordering. Vector size grows with participating identities; bounded actor sets or carefully specified alternatives trade metadata cost for simpler membership. A clock comparison does not resolve semantic conflicts in the document.
5. Validation, follow-ups and self-review
Exercise concurrent, sequential and merged edits, then restart replicas with old state. Follow-up: what changes when thousands of transient clients write? Reward partial-order reasoning, identity lifecycle and honest conflict handling rather than a last-writer timestamp shortcut.
Sources and related practice
Technical reference: www.allthingsdistributed.com — Causal versioning and concurrent versions in the original Dynamo paper.
Source publication/update: 2007. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.
Continue with Design an offline-capable collaborative document editor; Keep a user's reads from moving backward across replicas.
Continue your preparation
Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.