Conflict-Free Replicated Data Types · seed 1 · A4, ink-friendly. The answer key prints on its own page for grown-ups.
به انگلیسی

Merge rules that make replicas agree

Computing · Data & Databases · ages 22-24
Name ______________________   Date ____________
  1. Three replicas each keep a slot of a shared counter, and the counter shows the sum of its slots. Replica A holds 4, replica B holds 1 and replica C holds 6. What does the merged counter show?

    Answer: ______________

  2. Replicas receive the same updates in different orders. What makes them converge?

    • A merge that is commutative, associative and idempotent
    • A faster network that delivers every update in the same order
    • A leader that collects every write and reorders them first
  3. With a concurrent add and remove of one element, the merge rule decides the outcome.

    Circle one:   True   False

  4. A set uses add-wins. An add and a remove of one photo race. What does every replica show?

    • The photo is absent everywhere
    • Each replica keeps its own answer
    • The photo is present everywhere
  5. Replica C sends its slot value of 6 to a replica. The same message arrives twice. What does the duplicate do?

    • Nothing, the slot still holds 6
    • It raises the slot to 12 and doubles the count
    • It breaks the replica until a leader repairs it
  6. Why can these replicas accept writes with no coordination?

    • Writes are held in memory and never stored durably
    • Conflicts are settled later by the merge
    • Networks never reorder or drop any of their messages
  7. An app keeps a set of allowed contacts. Blocking someone removes them, and unblocking adds them back. A block and an unblock race. The person must stay blocked. Which merge rule fits?

    • Add-wins, because the unblock keeps the person on the list
    • Remove-wins, because the block wins when the two race
    • Either rule, because both give every replica one answer
  8. Kim says her merged set always matches what the users intended. What is wrong?

    • Merges are too slow for users to ever notice a result
    • Replicas that merge can never actually reach one state
    • The rule picks mechanically and may surprise users
LightMySky · lightmysky.comW1-mt_Bhf1nu-9jz-s1

Answer key

For grown-ups. Fold this page away before handing over the rest.

Merge rules that make replicas agree W1-mt_Bhf1nu-9jz-s1

  1. 11 · Merging keeps the highest value seen for each slot, and the counter shows the sum of the slots: 4 plus 1 plus 6.
  2. A merge that is commutative, associative and idempotent · The merge properties make arrival order irrelevant.
  3. True · The rule, not the users, settles the race.
  4. The photo is present everywhere · Add-wins keeps the element on every replica.
  5. Nothing, the slot still holds 6 · Each slot keeps its highest seen value, so a repeat of 6 changes nothing.
  6. Conflicts are settled later by the merge · Accept now, reconcile at merge time.
  7. Remove-wins, because the block wins when the two race · Blocking is a remove. Remove-wins drops the element whenever a remove races an add, so the person stays blocked.
  8. The rule picks mechanically and may surprise users · Convergence promises agreement, not intent.
Worksheet · LightMySky