←back to thread

222 points charlieirish | 9 comments | | HN request time: 1.666s | source | bottom
Show context
ezekg ◴[] No.43537495[source]
It'd be nice if the post went into how conflict resolution will (?) work because that's the hard part here and the main selling point imo.
replies(4): >>43537590 #>>43537889 #>>43540353 #>>43541448 #
1. bob1029 ◴[] No.43537590[source]
Conflict resolution can't work in a general sense.

How you reconcile many copies of the same record could depend on time of action, server location, authority level of the user, causality between certain business events, enabled account features, prior phase of the moon, etc.

Whether or not offline sync can even work is very much a domain specific concern. You need to talk to the business about the pros & cons first. For example, they might not like the semantics regarding merchant terminals and offline processing. I can already hear the "what if the terminal never comes back online?" afternoon meeting arising out of that one.

replies(3): >>43539211 #>>43539276 #>>43540843 #
2. ochiba ◴[] No.43539211[source]
I would say this is why server-authoritative systems that allow for custom logic in the backend for conflict resolution work well in practice (like Replicache, PowerSync and Zero - custom mutators coming in beta for the latter). Predefined deterministic distributed conflict resolution such as CRDT data structures work well for certain use cases like text editing, but many other use cases require deeper customizability based on various factors like you said.
replies(2): >>43539258 #>>43539279 #
3. jahewson ◴[] No.43539258[source]
CRDT falls flat for rich text editing though. So many nasty edge cases and nobody has solved them all, despite their claims.
replies(1): >>43539618 #
4. jahewson ◴[] No.43539276[source]
This. It’s so obvious when you think about it, but everybody wants a free lunch.
5. ezekg ◴[] No.43539279[source]
Server-authoritative conflict resolution kind of mirrors my thinking as well, having resolution work like multiplayer net code, where the client and server may or may not attempt to resolve recent conflicts, but server has the final say on state. Just not sure how this plays out when a client starts dropping conflicting data because the server says so...
replies(1): >>43539304 #
6. ochiba ◴[] No.43539304{3}[source]
Yes, exactly. https://www.gabrielgambetta.com/client-side-prediction-serve...
7. mentalgear ◴[] No.43539618{3}[source]
have you tried loro
replies(1): >>43540152 #
8. mmerlin ◴[] No.43540152{4}[source]
https://loro.dev/
9. larkost ◴[] No.43540843[source]
CFRDT (Conflict Free Replicated Data Types) can absolutely reconcile many-writers situations. There are a number of these systems, and they all have their own rules around that replication (sometimes very complicated rules that are hard to reason about). As long as you can live inside those rules, and accept that they are going to have sharp corners that don't quite make sense for your use case, then you can get a virtually free lunch there.

But living inside of those rules (and sometimes just understanding those rules) can be a big ask in some situations, so you have to know what you are doing.