5 ms·
(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
by astigsen 10y ago
(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-resolution https://realm.io/docs/realm-object-server/#conflict-resoluti...
- btown 10y agoThat 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.
- bigfish24 10y agoSorry 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!
- bsaul 10y agoThanks 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.
- bigfish24 10y agoTime 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.
- gjjrfcbugxbhf 10y agoHow do you know whether timestamps are synchronized if network is partitioned?
- simonask 10y agoWe 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.
- gjjrfcbugxbhf 10y agoOK 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.