Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

of

Collaborative text editing Slide 1 Collaborative text editing Slide 2 Collaborative text editing Slide 3 Collaborative text editing Slide 4 Collaborative text editing Slide 5 Collaborative text editing Slide 6 Collaborative text editing Slide 7 Collaborative text editing Slide 8 Collaborative text editing Slide 9 Collaborative text editing Slide 10 Collaborative text editing Slide 11 Collaborative text editing Slide 12 Collaborative text editing Slide 13 Collaborative text editing Slide 14 Collaborative text editing Slide 15 Collaborative text editing Slide 16 Collaborative text editing Slide 17 Collaborative text editing Slide 18 Collaborative text editing Slide 19 Collaborative text editing Slide 20 Collaborative text editing Slide 21 Collaborative text editing Slide 22 Collaborative text editing Slide 23 Collaborative text editing Slide 24 Collaborative text editing Slide 25 Collaborative text editing Slide 26 Collaborative text editing Slide 27 Collaborative text editing Slide 28 Collaborative text editing Slide 29 Collaborative text editing Slide 30 Collaborative text editing Slide 31 Collaborative text editing Slide 32 Collaborative text editing Slide 33 Collaborative text editing Slide 34 Collaborative text editing Slide 35 Collaborative text editing Slide 36 Collaborative text editing Slide 37 Collaborative text editing Slide 38 Collaborative text editing Slide 39 Collaborative text editing Slide 40 Collaborative text editing Slide 41 Collaborative text editing Slide 42 Collaborative text editing Slide 43 Collaborative text editing Slide 44 Collaborative text editing Slide 45 Collaborative text editing Slide 46 Collaborative text editing Slide 47 Collaborative text editing Slide 48 Collaborative text editing Slide 49 Collaborative text editing Slide 50 Collaborative text editing Slide 51 Collaborative text editing Slide 52 Collaborative text editing Slide 53 Collaborative text editing Slide 54 Collaborative text editing Slide 55 Collaborative text editing Slide 56 Collaborative text editing Slide 57 Collaborative text editing Slide 58 Collaborative text editing Slide 59 Collaborative text editing Slide 60 Collaborative text editing Slide 61 Collaborative text editing Slide 62 Collaborative text editing Slide 63 Collaborative text editing Slide 64 Collaborative text editing Slide 65 Collaborative text editing Slide 66 Collaborative text editing Slide 67 Collaborative text editing Slide 68 Collaborative text editing Slide 69 Collaborative text editing Slide 70 Collaborative text editing Slide 71 Collaborative text editing Slide 72 Collaborative text editing Slide 73 Collaborative text editing Slide 74 Collaborative text editing Slide 75 Collaborative text editing Slide 76 Collaborative text editing Slide 77 Collaborative text editing Slide 78 Collaborative text editing Slide 79 Collaborative text editing Slide 80 Collaborative text editing Slide 81 Collaborative text editing Slide 82 Collaborative text editing Slide 83 Collaborative text editing Slide 84 Collaborative text editing Slide 85 Collaborative text editing Slide 86 Collaborative text editing Slide 87 Collaborative text editing Slide 88 Collaborative text editing Slide 89 Collaborative text editing Slide 90 Collaborative text editing Slide 91 Collaborative text editing Slide 92 Collaborative text editing Slide 93 Collaborative text editing Slide 94 Collaborative text editing Slide 95 Collaborative text editing Slide 96 Collaborative text editing Slide 97 Collaborative text editing Slide 98 Collaborative text editing Slide 99 Collaborative text editing Slide 100 Collaborative text editing Slide 101 Collaborative text editing Slide 102 Collaborative text editing Slide 103
Upcoming SlideShare
What to Upload to SlideShare
Next
Download to read offline and view in fullscreen.

1 Like

Share

Download to read offline

Collaborative text editing

Download to read offline

This is presentiation for Lambda Days 2019, in which I describe details behind building collaborative text editing experience using Replicated Growable Array CRDTs. Later on we come to defining its issues and how to solve them.

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Collaborative text editing

  1. 1. COLLABORATIVE TEXT EDITING
  2. 2. INTRODUCTION Bartosz Sypytkowski ▪ @Horusiath ▪ b.sypytkowski@gmail.com ▪ bartoszsypytkowski.com
  3. 3.  What’s the problem?  Opertional Transfromations  Replicated Growable Arrays  How do we replicate?  How to optimize this thing?  How to collect garbage? AGENDA
  4. 4. PROBLEM Alice Bob CONTINOUS CONTINOUS
  5. 5. PROBLEM Alice Bob CONTINOUS ins(5, U) CONTINOUS ins(8, ?)
  6. 6. PROBLEM Alice Bob CONTINOUS ins(5, U) CONTINUOUS CONTINOUS ins(8, ?) CONTINOUS?
  7. 7. PROBLEM Alice Bob CONTINOUS ins(5, U) CONTINUOUS CONTINOUS ins(8, ?) CONTINOUS? ins(5, U)
  8. 8. PROBLEM Alice Bob CONTINOUS ins(5, U) CONTINUOUS CONTINOUS ins(8, ?) CONTINOUS? CONTINUOUS? ins(5, U)
  9. 9. PROBLEM Alice Bob CONTINOUS ins(5, U) CONTINUOUS CONTINOUS ins(8, ?) CONTINOUS? ins(8, ?) CONTINUOUS? ins(5, U)
  10. 10. PROBLEM Alice Bob CONTINOUS ins(5, U) CONTINUOUS CONTINOUS ins(8, ?) CONTINOUS? CONTINUOU?S ins(8, ?) CONTINUOUS? ins(5, U)
  11. 11. PROBLEM Alice Bob CONTINOUS ins(5, U) CONTINUOUS CONTINOUS ins(8, ?) CONTINOUS? CONTINUOU?S ins(8, ?) CONTINUOUS? ins(5, U)
  12. 12. WHY NOT JUST USE CENTRAL DATABASE ? 1. A single contributor can issue hundreds of ops/min. 2. Lag cannot be visible for a naked eye. 3. We should accept periodic disconnections, the longer the better. 4. … and maybe push the cost to the edges?
  13. 13. OPERATIONAL TRANSFORMATION As seen in Google Docs, Apache Wave and Etherpad
  14. 14. OPERATIONAL TRANSFORMATION Alice Bob C O N T I N O U S C O N T I N O U S
  15. 15. OPERATIONAL TRANSFORMATION Alice Bob C O N T I N O U S ins(6, U, A) C O N T I N O U S ins(9, ?, B)
  16. 16. OPERATIONAL TRANSFORMATION Alice Bob C O N T I N O U S ins(6, U, A) C O N T I N U O U S +1 +1 +1 +1 +1 C O N T I N O U S ins(9, ?, B) C O N T I N O U S ? +1 +1
  17. 17. OPERATIONAL TRANSFORMATION Alice Bob C O N T I N O U S ins(6, U, A) C O N T I N U O U S +1 +1 +1 +1 +1 C O N T I N O U S ins(9, ?, B) C O N T I N O U S ? +1 +1 ins(9, ?, B) C O N T I N U O U S +1 +1 +1 +1 +1
  18. 18. OPERATIONAL TRANSFORMATION Alice Bob C O N T I N O U S ins(6, U, A) C O N T I N U O U S +1 +1 +1 +1 +1 C O N T I N O U S ins(9, ?, B) C O N T I N O U S ? +1 +1 C O N T I N U O U S ? ins(9, ?, B) +1 +1 +1 +1 +1 +1 +1 +1
  19. 19. OPERATIONAL TRANSFORMATION Alice Bob C O N T I N O U S ins(6, U, A) C O N T I N U O U S +1 +1 +1 +1 +1 C O N T I N O U S ins(9, ?, B) C O N T I N O U S ? +1 +1 C O N T I N U O U S ? ins(6, U, A)ins(9, ?, B) +1 +1 +1 +1 +1 +1 +1 +1 C O N T I N O U S ? +1 +1
  20. 20. OPERATIONAL TRANSFORMATION Alice Bob C O N T I N O U S ins(6, U, A) C O N T I N U O U S +1 +1 +1 +1 +1 C O N T I N O U S ins(9, ?, B) C O N T I N O U S ? +1 +1 C O N T I N U O U S ? C O N T I N U O U S ? ins(6, U, A)ins(9, ?, B) +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1 +1
  21. 21. “Unfortunately, implementing OT sucks” PROBLEM WITH OPERATIONAL TRANSFORMATION - Joseph Gentle (Google Wave, ShareJS)
  22. 22. REPLICATED GROWABLE ARRAY
  23. 23. WE NEED IMMUTABLE INDEXES 1:AABSOLUTE INDEX ID UNIQUE REPLICA ID
  24. 24. REPLICATED GROWABLE ARRAY Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A
  25. 25. REPLICATED GROWABLE ARRAY Alice Bob C O N T I N O U S ins(6A, U, 10A) 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N O U S ins(9A, ?, 10B) 1A 2A 3A 4A 5A 6A 7A 8A 9A
  26. 26. REPLICATED GROWABLE ARRAY Alice Bob C O N T I N O U S ins(6A, U, 10A) 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S ins(9A, ?, 10B) 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N O U S ? 1A 2A 3A 4A 5A 6A 7A 8A 9A 10B
  27. 27. REPLICATED GROWABLE ARRAY Alice Bob C O N T I N O U S ins(6A, U, 10A) 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S ins(9A, ?, 10B) 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N O U S ? 1A 2A 3A 4A 5A 6A 7A 8A 9A 10B ins(9A, ?, 10B)
  28. 28. REPLICATED GROWABLE ARRAY Alice Bob C O N T I N O U S ins(6A, U, 10A) 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S ins(9A, ?, 10B) 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N O U S ? 1A 2A 3A 4A 5A 6A 7A 8A 9A 10B C O N T I N U O U S ? 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A 10B ins(9A, ?, 10B)
  29. 29. REPLICATED GROWABLE ARRAY Alice Bob C O N T I N O U S ins(6A, U, 10A) 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S ins(9A, ?, 10B) 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N O U S ? 1A 2A 3A 4A 5A 6A 7A 8A 9A 10B C O N T I N U O U S ? 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A 10B ins(6A, U, 10A)ins(9A, ?, 10B)
  30. 30. REPLICATED GROWABLE ARRAY Alice Bob C O N T I N O U S ins(6A, U, 10A) 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S ins(9A, ?, 10B) 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N O U S ? 1A 2A 3A 4A 5A 6A 7A 8A 9A 10B C O N T I N U O U S ? 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A 10B C O N T I N U O U S ? 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A 10B ins(6A, U, 10A)ins(9A, ?, 10B)
  31. 31. HOW TO INSERT AT THE SAME POSITION?
  32. 32. HOW TO INSERT AT THE SAME POSITION? 6A < 6B MAKE POSITIONS COMPARABLE
  33. 33. REPLICATED GROWABLE ARRAY INSERT AT THE SAME POSITION Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A
  34. 34. REPLICATED GROWABLE ARRAY INSERT AT THE SAME POSITION Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A ins(6A, U, 10A) ins(6A, N, 10B)
  35. 35. REPLICATED GROWABLE ARRAY INSERT AT THE SAME POSITION Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N N O U S 1A 2A 3A 4A 5A 6A 10B 7A 8A 9A ins(6A, U, 10A) ins(6A, N, 10B)
  36. 36. REPLICATED GROWABLE ARRAY INSERT AT THE SAME POSITION Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N N O U S 1A 2A 3A 4A 5A 6A 10B 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A ins(6A, U, 10A) ins(6A, N, 10B) ins(6A, N, 10B)
  37. 37. REPLICATED GROWABLE ARRAY INSERT AT THE SAME POSITION Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N N O U S 1A 2A 3A 4A 5A 6A 10B 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A ins(6A, U, 10A) ins(6A, N, 10B) ins(6A, N, 10B) 10B > 10A
  38. 38. REPLICATED GROWABLE ARRAY INSERT AT THE SAME POSITION Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N N O U S 1A 2A 3A 4A 5A 6A 10B 7A 8A 9A C O N T I N N U O U S 1A 2A 3A 4A 5A 6A 10B 10A 7A 8A 9A ins(6A, U, 10A) ins(6A, N, 10B) ins(6A, N, 10B)
  39. 39. REPLICATED GROWABLE ARRAY INSERT AT THE SAME POSITION Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N N O U S 1A 2A 3A 4A 5A 6A 10B 7A 8A 9A C O N T I N N U O U S 1A 2A 3A 4A 5A 6A 10B 10A 7A 8A 9A C O N T I N N O U S 1A 2A 3A 4A 5A 6A 10B 7A 8A 9A ins(6A, U, 10A) ins(6A, N, 10B) ins(6A, N, 10B) ins(6A, U, 10A)
  40. 40. REPLICATED GROWABLE ARRAY INSERT AT THE SAME POSITION Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N N O U S 1A 2A 3A 4A 5A 6A 10B 7A 8A 9A C O N T I N N U O U S 1A 2A 3A 4A 5A 6A 10B 10A 7A 8A 9A C O N T I N N O U S 1A 2A 3A 4A 5A 6A 10B 7A 8A 9A ins(6A, U, 10A) ins(6A, N, 10B) ins(6A, N, 10B) ins(6A, U, 10A) 10A < 10B
  41. 41. REPLICATED GROWABLE ARRAY INSERT AT THE SAME POSITION Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N N O U S 1A 2A 3A 4A 5A 6A 10B 7A 8A 9A C O N T I N N U O U S 1A 2A 3A 4A 5A 6A 10B 10A 7A 8A 9A C O N T I N N O U S 1A 2A 3A 4A 5A 6A 10B 7A 8A 9A ins(6A, U, 10A) ins(6A, N, 10B) ins(6A, N, 10B) ins(6A, U, 10A) 10A > 7A
  42. 42. REPLICATED GROWABLE ARRAY INSERT AT THE SAME POSITION Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N N O U S 1A 2A 3A 4A 5A 6A 10B 7A 8A 9A C O N T I N N U O U S 1A 2A 3A 4A 5A 6A 10B 10A 7A 8A 9A C O N T I N N U O U S 1A 2A 3A 4A 5A 6A 10B 10A 7A 8A 9A ins(6A, U, 10A) ins(6A, N, 10B) ins(6A, N, 10B) ins(6A, U, 10A)
  43. 43. HOW TO INSERT AND DELETE AT THE SAME POSITION?
  44. 44. HOW TO INSERT AND DELETE AT THE SAME POSITION? TOMBSTONES
  45. 45. REPLICATED GROWABLE ARRAY INSERT AND DELETE AT THE SAME POSITION Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A
  46. 46. REPLICATED GROWABLE ARRAY INSERT AND DELETE AT THE SAME POSITION Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A ins(6A, U, 10A) del(6A)
  47. 47. REPLICATED GROWABLE ARRAY INSERT AND DELETE AT THE SAME POSITION Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A ins(6A, U, 10A) del(6A)
  48. 48. REPLICATED GROWABLE ARRAY INSERT AND DELETE AT THE SAME POSITION Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A ins(6A, U, 10A) del(6A) del(6A)
  49. 49. REPLICATED GROWABLE ARRAY INSERT AND DELETE AT THE SAME POSITION Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A ins(6A, U, 10A) del(6A) del(6A)
  50. 50. REPLICATED GROWABLE ARRAY INSERT AND DELETE AT THE SAME POSITION Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A ins(6A, U, 10A) del(6A) ins(6A, U, 10A)del(6A)
  51. 51. REPLICATED GROWABLE ARRAY INSERT AND DELETE AT THE SAME POSITION Alice Bob C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I N U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A C O N T I N O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I O U S 1A 2A 3A 4A 5A 6A 7A 8A 9A C O N T I U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A ins(6A, U, 10A) del(6A) ins(6A, U, 10A)del(6A) C O N T I U O U S 1A 2A 3A 4A 5A 6A 10A 7A 8A 9A
  52. 52. REPLICATED GROWABLE ARRAYS HOW TO REPLICATE OPERATIONS?
  53. 53. • We need to ensure that every operation was received by every node… • … and at the same time we cannot wait for confirmation before displaying it. IS THERE ANY PROBLEM?
  54. 54. • We need to ensure that every operation was received by every node… • … and at the same time we cannot wait for confirmation before displaying it. IS THERE ANY PROBLEM?
  55. 55. EVENTSOURCING Alice (1, ins(1A, ‘H’, 2A)) (2, ins(2A, ‘e’, 3A)) (3, ins(3A, ‘l’, 4A)) (4, ins(4A, ‘l’, 5A)) (5, ins(5A, ‘o’, 6A))
  56. 56. PARTIALLY ORDERED LOG Alice . . . ins(6A, ‘o’, 7A) ins(7A, ‘u’, 8A) ins(8A, ‘s’, 9A) ins(6A, ‘u’, 10A) ins(6A, ‘n’, 10B) Bob . . . ins(6A, ‘o’, 7A) ins(7A, ‘u’, 8A) ins(8A, ‘s’, 9A) ins(6A, ‘n’, 10B) ins(6A, ‘u’, 10A)
  57. 57. Other “features”? 1. File format?PARTIALLY ORDERED LOG
  58. 58. Other “features”? 1. File format?PARTIALLY ORDERED LOG
  59. 59. Other “features”? 1. File format? 2. History (undo/redo) PARTIALLY ORDERED LOG
  60. 60. REPLICATED GROWABLE ARRAYS ANY PROBLEMS?
  61. 61. BLOCK-WISE REPLICATED GROWABLE ARRAYS … OR HOW TO ADD MORE THAN ONE CHAR AT THE TIME
  62. 62. METADATA OVERHEAD H 1 A 2 A ACTUAL PAYLOAD (SINGLE CHARACTER) CURRENT POSITION NEXT CHAR POSITION
  63. 63. ABSOLUTE POSITION + OFFSET 1A:0ABSOLUTE INDEX ID + REPLICA ID BLOCK OFFSET
  64. 64. COMPAR ING VECTOR CLOCKS BLOCKWISE REPLICATED GROWABLE ARRAY I WAS EXPECTING IT 1A:0
  65. 65. COMPAR ING VECTOR CLOCKS BLOCKWISE REPLICATED GROWABLE ARRAY I WAS EXPECTING IT 1A:0 ins(1A:5, NOT, 2B)
  66. 66. COMPAR ING VECTOR CLOCKS BLOCKWISE REPLICATED GROWABLE ARRAY I WAS 1A:0 ins(1A:5, NOT, 2B) EXPECTING IT 1A:5 link
  67. 67. COMPAR ING VECTOR CLOCKS BLOCKWISE REPLICATED GROWABLE ARRAY I WAS 1A:0 EXPECTING IT 1A:5 link NOT 2B:0
  68. 68. BLOCKWISE REPLICATED GROWABLE ARRAYS DELETING BLOCK OF DATA
  69. 69. TOMBSTONING I WAS 1A:0 EXPECTING IT 1A:5 link NOT 2B:0 del(1A:12, 3) BLOCKWISE REPLICATED GROWABLE ARRAYS
  70. 70. I WAS 1A:0 EXPECT 1A:5 link NOT 2B:0 del(1A:12, 3) ITING BLOCKWISE REPLICATED GROWABLE ARRAYS TOMBSTONING
  71. 71. I WAS 1A:0 EXPECT 1A:5 link NOT 2B:0 del(1A:12, 3) ITING 1A:12 1A:15 link link BLOCKWISE REPLICATED GROWABLE ARRAYS TOMBSTONING
  72. 72. I WAS 1A:0 EXPECT 1A:5 link NOT 2B:0 IT--- 1A:12 1A:15 link link BLOCKWISE REPLICATED GROWABLE ARRAYS TOMBSTONING
  73. 73. TOMBSTONES HOW TO GET RID OF THEM?
  74. 74. WE CAN ONLY INSERT ELEMENTS AFTER BLOCKS WE SEE (NOT TOMBSTONES)
  75. 75. I WAS 1A:0 EXPECTING IT 1A:5 link t1 2B:0 del(1A:12, 3, t3) TOMBSTONE PRUNNING
  76. 76. I WAS 1A:0 EXPECT 1A:5 link t1 2B:0 ITt3 1A:12 1A:15 link link TOMBSTONE PRUNNING
  77. 77. I WAS 1A:0 EXPECT 1A:5 link t1 2B:0 ITt3 1A:12 1A:15 link link TOMBSTONE PRUNNING prune(t2)
  78. 78. I WAS 1A:0 EXPECT 1A:5 link t1 2B:0 ITt3 1A:12 1A:15 link link TOMBSTONE PRUNNING t1 < t2
  79. 79. I WAS 1A:0 EXPECT 1A:5 link ITt3 1A:12 1A:15 link link TOMBSTONE PRUNNING t3 > t2
  80. 80. I WAS 1A:0 EXPECT 1A:5 link ITt3 1A:12 1A:15 link link TOMBSTONE PRUNNING
  81. 81. CAN WE USE WALLCLOCK TIME FOR TIMESTAMPING?
  82. 82. “In transactions, timekeeping is more about order of operations than actual time.”
  83. 83. SEQUENCERS Set X = 1 ts = 1 Set Y = 2 ts = 2 Set X = 3 ts = 3 Delete Y ts = 4 Set Y = 1 ts = 5 Delete X ts = 6 Monotonically incrementing counter timeline Node A
  84. 84. DOTS Set X = 1 A:1 Set X = 3 A:2 Set Y = 1 A:3 Delete X A:4 timeline Node A Set Y = 2 B:1 Delete Y B:2 timeline Node B
  85. 85. VECTOR CLOCKS Set X = 1 Set X = 3 Set Y = 1 Delete X Node A Set Y = 2 Delete Y Node B A 1 A 1 B 1 A 2 B 1 A 2 B 2 A 3 B 2 A 4 B 2
  86. 86. COMPAR ING VECTOR CLOCKS PARTIAL ORDERING Equals Greater than Less than Concurrent A 2 B 3 C 1 A 2 B 3 C 1 A 2 B 3 C 2 A 2 B 3 C 1 A 2 B 2 C 1 A 2 B 3 C 1 A 2 B 3 C 1 A 2 B 2 C 2 = = = = = > = < = = > <
  87. 87. COMPAR ING VECTOR CLOCKS RESOLVING CONCURRENT UPDATES Node 1 Node 2 Bob Joe t1 SET X = 2SET X = 1 t2
  88. 88. COMPAR ING VECTOR CLOCKS RESOLVING CONCURRENT UPDATES Node 1 Node 2 Bob Joe t1 SET X = 2SET X = 1 t2 max (t1, t2) max (t1, t2)
  89. 89. LAST WRITE WINS MAX (2018-09-15T15:53:00, 2019-01-12T17:47:13) = 2019-01-12T17:47:13
  90. 90. VECTOR CLOCK MERGE MAX ( , ) = A 1 B 3 A 2 B 1 C 1 A 2 B 3 C 1
  91. 91. HOW TO DETERMINE “SEEN BY ALL”? DOT VECTOR CLOCK ???
  92. 92. MATRIX CLOCKS 2 2 1 2 3 1 1 2 2 A B C A B C Observers Observed
  93. 93. MATRIX CLOCKS 2 2 1 2 3 1 1 2 2 A B C A B C SEEN-BY-ALL MIN
  94. 94. MATRIX CLOCKS 2 2 1 2 3 1 1 2 2 A B C A B C SEEN-BY-ALL MIN 1 2 1
  95. 95. MATRIX CLOCKS 2 2 1 2 3 1 1 2 2 A B C A B C SEEN-BY-ALL MIN 1 2 1 Our pruning point
  96. 96. I WAS 1A:0 EXPECTING IT 1A:5 link {A:2, B:2} 2B:0 del(1A:12, 3, {A:4,B:2}) TOMBSTONE PRUNNING
  97. 97. I WAS 1A:0 EXPECT 1A:5 link {A:2, B:2} 2B:0 IT{A:4, B:2} 1A:12 1A:15 link link TOMBSTONE PRUNNING
  98. 98. I WAS 1A:0 EXPECT 1A:5 link {A:2, B:2} 2B:0 IT{A:4, B:2} 1A:12 1A:15 link link TOMBSTONE PRUNNING prune({A:3,B:2})
  99. 99. I WAS 1A:0 EXPECT 1A:5 link {A:2, B:2} 2B:0 IT{A:4, B:2} 1A:12 1A:15 link link TOMBSTONE PRUNNING {A:2,B:2} < {A:3,B:2}
  100. 100. I WAS 1A:0 EXPECT 1A:5 link IT{A:4, B:2} 1A:12 1A:15 link link TOMBSTONE PRUNNING {A:4,B:2} > {A:3,B:2}
  101. 101. I WAS 1A:0 EXPECT 1A:5 link IT{A:4, B:2} 1A:12 1A:15 link link TOMBSTONE PRUNNING
  102. 102.  Operational transformation discussion on HN: https://news.ycombinator.com/item?id=12311984  JSON CRDT by Martin Kleppman: https://www.youtube.com/watch?v=B5NULPSiOGw  Rope data structure: https://www.geeksforgeeks.org/ropes-data-structure-fast-string-concatenation/  Blockwise Replicated Growable Arrays: https://pages.lip6.fr/Marc.Shapiro/papers/rgasplit-group2016-11.pdf  Examples of CRDT implementations: https://github.com/Horusiath/crdt-examples/ REFERENCES
  103. 103. THANK YOU
  • AnnMitchell22

    Dec. 4, 2021

This is presentiation for Lambda Days 2019, in which I describe details behind building collaborative text editing experience using Replicated Growable Array CRDTs. Later on we come to defining its issues and how to solve them.

Views

Total views

496

On Slideshare

0

From embeds

0

Number of embeds

28

Actions

Downloads

8

Shares

0

Comments

0

Likes

1

×