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

Interleaving anomalies in collaborative text ed...

Interleaving anomalies in collaborative text editors

Slides from a talk given on 25 March 2019 at 6th Workshop on Principles and Practice of Consistency for Distributed Data (PaPoC), Dresden, Germany.

Abstract:

Collaborative text editors allow two or more users to concurrently edit a shared document without merge conflicts. Such systems require an algorithm to provide convergence, ensuring all clients that have seen the same set of document edits are in the same state. Unfortunately convergence alone does not guarantee that a collaborative text editor is usable. Several published algorithms for collaborative text editing exhibit an undesirable anomaly in which concurrently inserted portions of text with a well-defined order may be randomly interleaved on a character-by-character basis, resulting in an unreadable jumble of letters. Although this anomaly appears to be known informally by some researchers in the field, we are not aware of any published work that fully explains or addresses it. We show that several algorithms suffer from this problem, explain its cause, and also identify a lesser variant of the anomaly that occurs in another algorithm. Moreover, we propose a specification of collaborative text editing that rules out the anomaly, and show how to prevent the lesser anomaly from occurring in one particular algorithm.

Martin Kleppmann

March 25, 2019
Tweet

More Decks by Martin Kleppmann

Other Decks in Research

Transcript

  1. Standard RGA: insertion op is triple (a, t, r) •

    a character being inserted • t operation timestamp (globally unique) • r timestamp of reference character To fix interleaving, change to 4-tuple (a, t, r, e) • e set of timestamps of all insertion operations with the same reference character r at the time the insertion was performed (not including t itself) I′ = I ∪ {(a, t, r, {t′|∃a′, e′. (a′, t′, r, e′) ∈ I})}
  2. (‘!’, τ1 , τ0 , {}) (‘ ’, τ2 ,

    τ0 , {τ1 }) (‘ ’, τ3 , τ0 , {τ1 }) (‘ ’, τ4 , τ0 , {τ1 , τ2 })
  3. (a 1 , t 1 , r, e 1 )

    < (a 2 , t 2 , r, e 2 ) if t 1 ∈ e 2 (a 2 , t 2 , r, e 2 ) < (a 1 , t 1 , r, e 1 ) if t 2 ∈ e 1 (‘!’, τ 1 , τ 0 , {}) (‘ ’, τ 2 , τ 0 , {τ 1 }) (‘ ’, τ3 , τ 0 , {τ 1 }) (‘ ’, τ4 , τ 0 , {τ 1 , τ2 }) < < < If (a 1 , t 1 , r, e 1 ) and (a 2 , t 2 , r, e 2 ) are concurrent (t 1 ∉ e 2 ∧ t 2 ∉ e 1 ): m 1 = min({t 1 } ∪ e 1 − e 2 ) m 2 = min({t 2 } ∪ e 2 − e 1 ) (a 1 , t 1 , r, e 1 ) < (a 2 , t 2 , r, e 2 ) if m 1 < m 2 (a 2 , t 2 , r, e 2 ) < (a 1 , t 1 , r, e 1 ) if m 2 < m 1 (‘ ’, τ 2 , τ 0 , {τ 1 }) (‘ ’, τ3 , τ 0 , {τ 1 }) min({τ2 } ∪ {τ1 } − {τ1 }) = τ2 min({τ3 } ∪ {τ1 } − {τ1 }) = τ3 < (‘ ’, τ4 , τ 0 , {τ 1 , τ2 }) (‘ ’, τ3 , τ 0 , {τ 1 }) min({τ3 } ∪ {τ1 } − {τ1 , τ2 }) = τ3 min({τ4 } ∪ {τ1 , τ2} − {τ1 }) = τ2 <
  4. Thanks! [email protected] @martinkl RGA proof of no interleaving: Martin Kleppmann,

    Victor B F Gomes, Dominic P Mulligan, and Alastair R Beresford: “OpSets: Sequential Specifications for Replicated Datatypes,” https://arxiv.org/abs/1805.04263, May 2018. Logoot: Stéphane Weiss, Pascal Urso, and Pascal Molli: “Logoot: A Scalable Optimistic Replication Algorithm for Collaborative Editing on P2P Networks,” ICDCS 2009. LSEQ: Brice Nédelec, Pascal Molli, Achour Mostefaoui, and Emmanuel Desmontils: “LSEQ: an Adaptive Structure for Sequences in Distributed Collaborative Editing,” DocEng 2013. RGA: Hyun-Gul Roh, Myeongjae Jeon, Jin-Soo Kim, and Joonwon Lee: “Replicated abstract data types: Building blocks for collaborative applications,” Journal of Parallel and Distributed Computing, 71(3):354–368, 2011. Treedoc: Nuno Preguiça, Joan Manuel Marques, Marc Shapiro, and Mihai Letia: “A Commutative Replicated Data Type for Cooperative Editing,” ICDCS 2009. WOOT: Gérald Oster, Pascal Urso, Pascal Molli, and Abdessamad Imine: “Data consistency for P2P collaborative editing,” CSCW 2006. Astrong : Hagit Attiya, Sebastian Burckhardt, Alexey Gotsman, Adam Morrison, Hongseok Yang, and Marek Zawirski: “Specification and Complexity of Collaborative Text Editing,” PODC 2016.