aspect ratio test slide apache couchdb sync deep dive
play

Aspect Ratio Test Slide APACHE COUCHDB SYNC DEEP DIVE by Jan - PowerPoint PPT Presentation

Aspect Ratio Test Slide APACHE COUCHDB SYNC DEEP DIVE by Jan Lehnardt at ApacheCon EU 2016 in Sevilla JAN LEHNARDT CouchDB since 2006 Apache CouchDB since 2008 PMC Chair & VP of CouchDB since 2011 Longest active contributor


  1. Database A Database B ID Last Name First Name ID Last Name First Name A0D31890… Abblesworth Antonia CA7BEA04… Chickleston Cecilia BE2EBD0B… Burrows Bertram DFFCFABC… Dunkington David CA7BEA04… Chickleston Cecilia DFFCFABC… Dunkington David By-Sequence Update Sequence Doc ID 1 CA7BEA04… 2 DFFCFABC… 3 A0D31890… 4 BE2EBD0B…

  2. Database A Database B ID Last Name First Name ID Last Name First Name A0D31890… Abblesworth Antonia A0D31890… Abblesworth Antonia BE2EBD0B… Burrows Bertram CA7BEA04… Chickleston Cecilia CA7BEA04… Chickleston Cecilia DFFCFABC… Dunkington David DFFCFABC… Dunkington David By-Sequence Update Sequence Doc ID 1 CA7BEA04… 2 DFFCFABC… 3 A0D31890… 4 BE2EBD0B…

  3. Database A Database B ID Last Name First Name ID Last Name First Name A0D31890… Abblesworth Antonia A0D31890… Abblesworth Antonia BE2EBD0B… Burrows Bertram BE2EBD0B… Burrows Bertram CA7BEA04… Chickleston Cecilia CA7BEA04… Chickleston Cecilia DFFCFABC… Dunkington David DFFCFABC… Dunkington David By-Sequence Update Sequence Doc ID 1 CA7BEA04… 2 DFFCFABC… 3 A0D31890… 4 BE2EBD0B…

  4. Database A Database B ID Last Name First Name ID Last Name First Name A0D31890… Abblesworth Antonia A0D31890… Abblesworth Antonia BE2EBD0B… Burrows Bertram BE2EBD0B… Burrows Bertram CA7BEA04… Chickleston Cecilia CA7BEA04… Chickleston Cecilia DFFCFABC… Dunkington David DFFCFABC… Dunkington David By-Sequence Update Sequence Doc ID High Watermark: 4 1 CA7BEA04… 2 DFFCFABC… 3 A0D31890… 4 BE2EBD0B…

  5. Database A Database B ID Last Name First Name ID Last Name First Name A0D31890… Abblesworth Antonia A0D31890… Abblesworth Antonia BE2EBD0B… Burrows Bertram BE2EBD0B… Burrows Bertram CA7BEA04… Chickleston Cecilia CA7BEA04… Chickleston Cecilia DFFCFABC… Dunkington David DFFCFABC… Dunkington David E328E255… Doe John By-Sequence Update Sequence Doc ID High Watermark: 4 1 CA7BEA04… 2 DFFCFABC… 3 A0D31890… 4 BE2EBD0B… 5 E328E255…

  6. Database A Database B ID Last Name First Name ID Last Name First Name A0D31890… Abblesworth Antonia A0D31890… Abblesworth Antonia BE2EBD0B… Burrows Bertram BE2EBD0B… Burrows Bertram CA7BEA04… Chickleston Cecilia CA7BEA04… Chickleston Cecilia DFFCFABC… Dunkington David DFFCFABC… Dunkington David E328E255… Doe John E328E255… Doe John By-Sequence Update Sequence Doc ID High Watermark: 5 1 CA7BEA04… 2 DFFCFABC… 3 A0D31890… 4 BE2EBD0B… 5 E328E255… Next: Updates

  7. UPDATES

  8. Database A Database B ID Last Name First Name ID Last Name First Name A0D31890… Abblesworth Antonia A0D31890… Abblesworth Antonia BE2EBD0B… Burrows Bertram BE2EBD0B… Burrows Bertram CA7BEA04… Chickleston Cecilia CA7BEA04… Chickleston Cecilia DFFCFABC… Dunkington David DFFCFABC… Dunkington David E328E255…* Esterhase John E328E255… Doe John By-Sequence Update Sequence Doc ID High Watermark: 5 1 CA7BEA04… 2 DFFCFABC… 3 A0D31890… 4 BE2EBD0B… 5 E328E255… 6 E328E255…*

  9. Database A Database B ID Last Name First Name ID Last Name First Name A0D31890… Abblesworth Antonia A0D31890… Abblesworth Antonia BE2EBD0B… Burrows Bertram BE2EBD0B… Burrows Bertram CA7BEA04… Chickleston Cecilia CA7BEA04… Chickleston Cecilia DFFCFABC… Dunkington David DFFCFABC… Dunkington David E328E255…* Esterhase John E328E255…* Esterhase John By-Sequence Update Sequence Doc ID High Watermark: 6 1 CA7BEA04… 2 DFFCFABC… 3 A0D31890… 4 BE2EBD0B… 5 E328E255… 6 E328E255…* Now we go back and make a typo

  10. Database A Database B ID Last Name First Name ID Last Name First Name A0D31890… Abblesworth Antonia A0D31890… Abblesworth Antonia BE2EBD0B… Burrows Bertram BE2EBD0B… Burrows Bertram CA7BEA04… Chickleston Cecilia CA7BEA04… Chickleston Cecilia DFFCFABC… Dunkington David DFFCFABC… Dunkington David E328E255…** Esterhose John E328E255… Doe John By-Sequence Update Sequence Doc ID High Watermark: 5 2 DFFCFABC… 3 A0D31890… 4 BE2EBD0B… 5 E328E255… 6 E328E255…* 7 E328E255…**

  11. Database A Database B ID Last Name First Name ID Last Name First Name A0D31890… Abblesworth Antonia A0D31890… Abblesworth Antonia BE2EBD0B… Burrows Bertram BE2EBD0B… Burrows Bertram CA7BEA04… Chickleston Cecilia CA7BEA04… Chickleston Cecilia DFFCFABC… Dunkington David DFFCFABC… Dunkington David E328E255…** Esterhose John E328E255…* Esterhase John By-Sequence Update Sequence Doc ID High Watermark: 6 2 DFFCFABC… 3 A0D31890… 4 BE2EBD0B… 5 E328E255… 6 E328E255…* 7 E328E255…** Wouldn’t it be more e ffi cient to just send update 7?

  12. Database A Database B ID Last Name First Name ID Last Name First Name A0D31890… Abblesworth Antonia A0D31890… Abblesworth Antonia BE2EBD0B… Burrows Bertram BE2EBD0B… Burrows Bertram CA7BEA04… Chickleston Cecilia CA7BEA04… Chickleston Cecilia DFFCFABC… Dunkington David DFFCFABC… Dunkington David E328E255…** Esterhose John E328E255…** Esterhose John By-Sequence Update Sequence Doc ID High Watermark: 7 1 CA7BEA04… 2 DFFCFABC… 3 A0D31890… 4 BE2EBD0B… 7 E328E255…** Why yes it would -> make the sequence table unique for doc ids Next: deletes

  13. DELETES

  14. Database A Database B ID Last Name First Name ID Last Name First Name A0D31890… Abblesworth Antonia A0D31890… Abblesworth Antonia BE2EBD0B… Burrows Bertram BE2EBD0B… Burrows Bertram CA7BEA04… Chickleston Cecilia CA7BEA04… Chickleston Cecilia DFFCFABC… Dunkington David DFFCFABC… Dunkington David E328E255…** Esterhose John E328E255…** Esterhose John By-Sequence Update Sequence Doc ID High Watermark: 7 2 DFFCFABC… 3 A0D31890… 4 BE2EBD0B… 7 E328E255…** 8 CA7BEA04… Wouldn’t it be more e ffi cient to just send update 7? Why yes it would -> make the sequence table unique for doc ids

  15. Database A Database B ID Last Name First Name ID Last Name First Name A0D31890… Abblesworth Antonia A0D31890… Abblesworth Antonia BE2EBD0B… Burrows Bertram BE2EBD0B… Burrows Bertram CA7BEA04… Chickleston Cecilia CA7BEA04… Chickleston Cecilia DFFCFABC… Dunkington David DFFCFABC… Dunkington David E328E255…** Esterhose John E328E255…** Esterhose John By-Sequence Update Sequence Doc ID High Watermark: 8 2 DFFCFABC… 3 A0D31890… 4 BE2EBD0B… 7 E328E255…** 8 CA7BEA04… Wouldn’t it be more e ffi cient to just send update 7? Why yes it would -> make the sequence table unique for doc ids

  16. SYNC INGREDIENTS ➤ Identity ➤ What happened since?

  17. QUESTIONS?

  18. VERSIONS * ** business, what’s up with that?

  19. AUTO INCREMENT * ** business, what’s up with that?

  20. VERSIONS: AUTO INCREMENT? Database A Database B ID Version Last Name First Name ID Version Last Name First Name A0D31890 1 Abblesworth Antonia …

  21. VERSIONS: AUTO INCREMENT? Database A Database B ID Version Last Name First Name ID Version Last Name First Name A0D31890 A0D31890 1 Abblesworth Antonia 1 Abblesworth Antonia … …

  22. VERSIONS: AUTO INCREMENT? Database A Database B ID Version Last Name First Name ID Version Last Name First Name A0D31890 A0D31890 2 Bobble sworth Antonia 2 Wibble sworth Antonia … … What is it about the auto-increment that is so appealing: strictly ordered in math terms: monotonically increasing what else is monotonically increasing?

  23. VERSIONS: AUTO INCREMENT? Database A Database B ID Version Last Name First Name ID Version Last Name First Name A0D31890 A0D31890 2 Bobble sworth Antonia 2 Wibble sworth Antonia … … 👏 👏 What is it about the auto-increment that is so appealing: strictly ordered in math terms: monotonically increasing what else is monotonically increasing?

  24. TIME! From: Falsehoods programmers believe about time, and the sequel. ALL OF THESE STATEMENTS ARE FALSE http://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time http://infiniteundo.com/post/25509354022/more-falsehoods-programmers-believe-about-time

  25. THE SYSTEM CLOCK WILL ALWAYS BE SET TO THE CORRECT LOCAL TIME.

  26. THE SYSTEM CLOCK WILL ALWAYS BE SET TO A TIME THAT IS NOT WILDLY DIFFERENT FROM THE CORRECT LOCAL TIME.

  27. IF THE SYSTEM CLOCK IS INCORRECT, IT WILL AT LEAST ALWAYS BE OFF BY A CONSISTENT NUMBER OF SECONDS.

  28. THE SERVER CLOCK AND THE CLIENT CLOCK WILL ALWAYS BE SET TO THE SAME TIME.

  29. THE SERVER CLOCK AND THE CLIENT CLOCK WILL ALWAYS BE SET TO AROUND THE SAME TIME.

  30. OK, BUT THE TIME ON THE SERVER CLOCK AND TIME ON THE CLIENT CLOCK WOULD NEVER BE DIFFERENT BY A MATTER OF DECADES.

  31. IF THE SERVER CLOCK AND THE CLIENT CLOCK ARE NOT IN SYNC, THEY WILL AT LEAST ALWAYS BE OUT OF SYNC BY A CONSISTENT NUMBER OF SECONDS.

  32. THE SERVER CLOCK AND THE CLIENT CLOCK WILL USE THE SAME TIME ZONE.

  33. THE SYSTEM CLOCK WILL NEVER BE SET TO A TIME THAT IS IN THE DISTANT PAST OR THE FAR FUTURE.

  34. ONE MINUTE ON THE SYSTEM CLOCK HAS EXACTLY THE SAME DURATION AS ONE MINUTE ON ANY OTHER CLOCK

  35. OK, BUT THE DURATION OF ONE MINUTE ON THE SYSTEM CLOCK WILL BE PRETTY CLOSE TO THE DURATION OF ONE MINUTE ON MOST OTHER CLOCKS.

  36. FINE, BUT THE DURATION OF ONE MINUTE ON THE SYSTEM CLOCK WOULD NEVER BE MORE THAN AN HOUR.

  37. A TIME STAMP OF SUFFICIENT PRECISION CAN SAFELY BE CONSIDERED UNIQUE.

  38. IT’S POSSIBLE TO ESTABLISH A TOTAL ORDERING ON TIMESTAMPS THAT IS USEFUL OUTSIDE YOUR SYSTEM.

  39. TIMESTAMPS ALWAYS ADVANCE MONOTONICALLY.

  40. MY SOFTWARE IS ONLY USED INTERNALLY/LOCALLY, SO I DON’T HAVE TO WORRY ABOUT TIMEZONES

  41. MY SOFTWARE STACK WILL HANDLE TIMEZONE WITHOUT ME NEEDING TO DO ANYTHING SPECIAL

  42. ALL MEASUREMENTS OF TIME ON A GIVEN CLOCK WILL OCCUR WITHIN THE SAME FRAME OF REFERENCE. In other words

  43. TIME PASSES AT THE SAME SPEED ON TOP OF A MOUNTAIN AND AT THE BOTTOM OF A VALLEY.

  44. TIMESTAMPS? NO Spanner 2FA Whatever the exact scenario, this is plausible and has documented occurrences in small and large-scale systems: you can’t rely on timestamps to guarantee the order of two items, even if the timestamps were generated on the same device as they lead to data loss and/or duplication. This is what happens under the hood when you suddenly have all your notes or contacts twice, after syncing your phone and your desktop. Or why that one contact always gets deleted when you try to sync from phone to desktop (but not the other way around) Ok. How can we improve on timestamps? Before we find out, we need to introduce one more new concept: conflicts.

  45. DISTRIBUTED SYSTEMS INTERLUDE

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend