News for hackers. Stuff that matters.
Re:Eventually Consistent: How to Make a Mobile-First Distrib... by astigsen on Thursday January 19, 2017 @01:42PM (#13438294)
(Alexander from Realm here) Yes, where this approach fits is very dependent on the use case. In our experience the key is to have a data model that is flexible enough to express many different use cases. There might be cases where updating a single field is enough, or you might need it to work as a counter, or maybe your data will be better modeled by ordered insertions into a list.

Having the flexibility to use the exact combination of data types that fits your specific requirements and allows you to express your intent in a way that makes it clear how you want the conflicts resolved is essential to make it work.

You can find a bit more info about our approach to conflict resolution here: https://realm.io/docs/realm-object-server/#conflict-resoluti...

Re:Eventually Consistent: How to Make a Mobile-First Distrib... by btown on Thursday January 19, 2017 @02:36PM (#13438792)
That design doc seems to mix loose ideas with the current state of the system. For instance, are strings last-write-wins currently, or do they have character-level OT? Congrats on the release - I'm a huge fan of realtime, and I'd like nothing more than to build apps that depend on such a system - but seeing documentation with those kinds of holes gives a really bad first impression.
Re:Eventually Consistent: How to Make a Mobile-First Distrib... by bigfish24 on Thursday January 19, 2017 @02:46PM (#13438870)
Sorry the docs are not clear. Right now you can only apply set operations on the entire string. Internally in the database core, we support substring operations, but we haven't exposed them yet mainly because we need to add the compliment to listen for these changes. We have a working collaborative text editor demo/prototype so hope to have more to say soon!
Re:Eventually Consistent: How to Make a Mobile-First Distrib... by bsaul on Thursday January 19, 2017 @06:08PM (#13440322)
Thanks for the link. when you mention "time" in the doc, what's the definition of "most recent" ? Do you mean, last one received by the server ? Or do you have any hint based on local state (either local time clock, or local logical clock) ? That would make a huge difference if, let's say, i reconnect an old unsynchronized device with pending, outdated, changes.
Re:Eventually Consistent: How to Make a Mobile-First Distrib... by bigfish24 on Thursday January 19, 2017 @10:07PM (#13441486)
Time means logical clock. We incorporate a number of mechanisms to track causality, such that for each changeset we know exactly which other changesets it was based on. Timestamps are only used when two changesets that are causally unrelated conflict, in which case we use the timestamp to decide on the ordering.
Re:Eventually Consistent: How to Make a Mobile-First Distrib... by gjjrfcbugxbhf on Friday January 20, 2017 @01:52AM (#13442107)
How do you know whether timestamps are synchronized if network is partitioned?
Re:Eventually Consistent: How to Make a Mobile-First Distrib... by simonask on Friday January 20, 2017 @02:23AM (#13442220)
We don't, and we don't need to.

Timestamps are only used to merge conflicting but causally unrelated changes. In principle we could pick a random number instead of using the timestamp and we would still achieve convergence, but it just so happens that the current local time on the device is highly correlated with the user's experience of real time, so that if the user makes conflicting changes on two offline devices, those changes will still be properly ordered in the general case.

Re:Eventually Consistent: How to Make a Mobile-First Distrib... by gjjrfcbugxbhf on Friday January 20, 2017 @10:49AM (#13444616)
OK good luck with that. I guess you keep a graph of all the changes so that the accidental overwrites that will happen+ can be stepped back?

+ for example a surprising number of computers have their local time changed to avoid license terms of poorly enforced proprietary software.