Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Moving elements in list CRDTs

Moving elements in list CRDTs

Slides from a talk at the 7th Workshop on Principles and Practice of Consistency for Distributed Data (PaPoC), 27 April 2020.
https://papoc-workshop.github.io/2020/
https://martin.kleppmann.com/2020/04/27/papoc-list-move.html

Abstract:

Conflict-free Replicated Data Types (CRDTs) for lists allow multiple users to concurrently insert and delete elements in a shared list object. However, existing algorithms behave poorly when users concurrently move list elements to a new position (i.e. reorder the elements in the list). We demonstrate the need for such a move operation, and describe an algorithm that extends a list CRDT with an explicit move operation. Our algorithm can be used in conjunction with any existing list CRDT algorithm. In addition to moving a single list element, we also discuss the open problem of moving ranges of elements.

Martin Kleppmann

April 24, 2020
Tweet

More Decks by Martin Kleppmann

Other Decks in Research

Transcript

  1. Moving elements
    in list CRDTs
    Martin Kleppmann
    University of Cambridge, UK
    [email protected]

    View full-size slide

  2. List (sequence, array) CRDTs: WOOT, Treedoc, Logoot,
    RGA, Causal Trees, LSEQ, …

    View full-size slide

  3. List (sequence, array) CRDTs: WOOT, Treedoc, Logoot,
    RGA, Causal Trees, LSEQ, …
    Emulating “move” as “delete-and-reinsert”:
    concurrent moves of the same item
    à duplication

    View full-size slide

  4. Concurrent move of the same item to different
    positions — what should happen?

    View full-size slide

  5. Converge to one of the destination positions
    (pick one arbitrarily but deterministically)

    View full-size slide

  6. “pick one arbitrarily”
    = last-writer wins register!
    posphone joe
    := “head of the list”
    merge
    posphone joe
    == “head of the list”
    posphone joe
    := “after buy milk”

    View full-size slide

  7. List CRDT with move operation
    posphone joe
    := “after buy milk”
    need one register per list item
    state = AWSet({ (v1
    , LWWRegister(p1
    )),
    (v2
    , LWWRegister(p2
    )),
    … })
    need a stable way of referencing list positions
    Treedoc: path through binary tree
    Logoot: list of (integer, replicaID) pairs
    RGA: s4vector
    Causal Trees: logical timestamp
    etc…
    Composition of any list CRDT + AWSet +
    LWWRegister = another CRDT

    View full-size slide

  8. Moving ranges of elements

    View full-size slide

  9. Moving ranges of elements

    View full-size slide

  10. Desired outcome

    View full-size slide

  11. Actual outcome
    Fixing this: an open problem!

    View full-size slide

  12. Thanks!
    Martin Kleppmann
    University of Cambridge, UK
    [email protected]

    View full-size slide