Thanks Mark and Chris, I see now that I need to use a strongly consistent framework of some kind for this operation.
- Hristo > On Jan 26, 2015, at 3:56 AM, Christopher Meiklejohn <cmeiklej...@basho.com> > wrote: > >> >> On Jan 23, 2015, at 5:32 PM, Hristo Asenov <hristo.s.ase...@gmail.com >> <mailto:hristo.s.ase...@gmail.com>> wrote: >> >> Hello everyone, >> >> I have noticed that in latest documentation on Riak data types >> (http://docs.basho.com/riak/latest/theory/concepts/crdts/#Counters >> <http://docs.basho.com/riak/latest/theory/concepts/crdts/#Counters>), for >> Counters it is not recommended to use them for ordered IDs (UUIDs). Can I >> implement g-counters (as described in the CRDT paper) using Riak’s Set >> datatype? I am wondering whether that will work out well for my use case. >> >> What I would like to do is to have synchronization of sequence numbers >> between multiple src processes that send their inputs to a single >> centralized process. I want all the sequence numbers to be unique so that >> the centralized process can create an ordering of the input messages based >> on the sequence numbers. Thus I would have an integer entry for each src >> process in the set, and the sum of all the integers would be my unique id. >> After the src process writes a value to the DHT for its corresponding entry, >> would it then have to read the value from the DHT in order to make sure it >> got committed without conflicts? > > Hi Hristo, > > I’m not sure if I completely followed your use case, but I believe that you > probably want strongly consistent operations if you want to generate a total > order over a series of operations. > > Using the sum of the integers of a G-Counter (or a G-Counter built on Riak’s > set data structure) does not guarantee a globally unique number; given these > counters are designed (and therefore allowed) to diverge, imagine the > following scenario, possible due to delays in replication: > > Replica A, G-Counter: > [{pid1, 2}, {pid2, 1}], Sum: 3 > > Replica B, G-Counter: > [{pid1, 1}, {pid2, 2}], Sum: 3 > > These both share the same sum, but should represent unique operations, right? > Did I understand correctly? > > Thanks, > - Chris > > Christopher Meiklejohn > Senior Software Engineer > Basho Technologies, Inc. > cmeiklej...@basho.com <mailto:cmeiklej...@basho.com>
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com