basho / riak_dt

Convergent replicated datatypes in Erlang
Apache License 2.0
353 stars 70 forks source link

Question: Why are multiple dots necessary per element in an ORSWOT? #142

Open widavies opened 9 months ago

widavies commented 9 months ago

I'm taking a look at the ORSWOT and trying to understand how it works. What doesn't quite make sense to me is this - why are multiple dots required for a single element? My first intuition was that you would only need to tag each element with a single dot for the most recent edit. If a element was a LWW register for example, when a concurrent edit is detected, we won't even bother appending each dot to the element (to have two). Instead, we'll just leave the dot present on each replica, but update the value to the more recent of the two changes. Then, the overarching version vector is updated to reflect that both replicas have merged in the other's change. In any case, I'm curious what I'm missing - why does each element need a dots() instead of just a dot() tagged against it and what goes wrong if only a single dot is used?

https://github.com/basho/riak_dt/blob/c2a3e1b8e3bc6f586f181558396683137ebe8c87/src/riak_dt_orswot.erl#L115