Structures

Complexity Intermediate

MvRegister

The LWWRegister discarded one report. This time, Alice reports that Eagle Creek is open while Bob reports that it is closed. Neither hiker has seen the other's note, so the notebooks keep both reports.

Open-gate and closed-gate reports share a notebook clip; a pencil and a blank resolution slip lie beside them.

Two notebooks hold two current answers

Alice writes Trail open in her notebook and tags it with a dot, A:1, as in the observed-remove set. Before that note reaches Bob, he writes Trail closed and tags it B:1. Each notebook contains one valid local answer, but neither write includes evidence that its writer saw the other report.

The writes are concurrent. A multi-value register keeps both as alternatives. Each surviving alternative is a sibling.

Notebook Before notes are exchanged After both notes arrive
Alice Trail openA:1 Trail openA:1
Trail closedB:1
Bob Trail closedB:1 Trail openA:1
Trail closedB:1
Carol No report Trail openA:1
Trail closedB:1
The write identities show that neither report followed the other.

The order in which Carol receives the notes does not settle the disagreement. After every note arrives, all three notebooks contain the same two alternatives.

One trail-status line

Keep both trail reports

Run Alice and Bob's preset race, or choose a trail status for any hiker. The notebooks retain writes that did not observe each other.

Conflict rule Keep concurrent writes as siblings.

Alice

No status received

No status

Field note trail-status: Trail open write identity A:1 · no other note received

Bob

No status received

No status

Field note trail-status: Trail closed write identity B:1 · no other note received

Carol

No status received

No status

Field note No note in this race Carol observes delivery

Trail relay Does not choose by arrival order 0 writes shared

Decision evidence No alternatives yet.

  1. No writes shared yet.

Enable JavaScript to run the demo. The race and expected result remain in the lesson.

Race Alice's open report against Bob's closed report.

Carol resolves what she observed

Carol's notebook now holds both siblings and her causal context, the record of the writes she has seen: [A:1, B:1]. She walks to Eagle Creek, inspects the bridge, and chooses a new trail status. Her new note records that she wrote it after seeing both earlier reports.

When Alice and Bob receive Carol's note, it replaces the two siblings that Carol observed. It cannot replace a report that Carol had not yet received. That unseen report would remain as another current alternative.

Someone must resolve the siblings

An MvRegister never picks a winner. Every reader must handle more than one value, and the siblings stay until someone writes a resolution that observed them.

The next lesson, RegisterMap, brings the ranger station back: it numbers every version, and the reader chooses which one to read.

The linked reference lab exposes the write tags, causal context, delayed messages, and observed resolution step.

Open the in-depth MvRegister sheet and lab

Sources and implementation

Sources: Watershed's MV-register kernel. The multi-value register is described in A comprehensive study of Convergent and Commutative Replicated Data Types.

Implementation: The demo calls the Watershed kernel through the site's Gleam toolkit. The trail relay carries notes without ordering them.