Basically the ids are document Ids. We will eventually have several billion
documents in our system, and each has a unique long id. Currently we are
using a database sequence to generate these longs. Having eliminated other
uses of the database, we didn't want to keep it around just to generate ids.
That is why I am looking to use ZooKeeper to generate them instead.
On Fri, Apr 24, 2009 at 8:27 AM, Benjamin Reed <br...@yahoo-inc.com> wrote:
> i'm not exactly clear how you use these ideas, but one source of unique ids
> that are longs is the zxid. if you create a znode, everytime you write to
> it, you will get a unique zxid in the mzxid member of the stat structure.
> (you get the stat structure back in the response to the setData.)
> Mahadev Konar wrote:
>> Hi Satish,
>> Most of the sequences (versions of nodes ) and the sequence flags are
>> We do have plans to move it to long.
>> But in your case I can imagine you can split a long into 2 32 bits -
>> Parent (which is int) -> child(which is int)
>> Now after you run out of child epehemarls then you should create a node
>> Parent + 1
>> Remove parent And then start creating an ephemeral child
>> (so parent (32 bits) and child (32 bits)) would form a long.
>> I don't think this should be very hard to implement. Their is nothing in
>> zookeeper (out of the box) currently that would help you out.
>> On 4/23/09 4:52 PM, "Satish Bhatti" <cthd2...@gmail.com> wrote:
>>> We currently use a database sequence to generate unique ids for use by
>>> application. I was thinking about using ZooKeeper instead so I can get
>>> of the database. My plan was to use the sequential id from ephemeral
>>> but looking at the code it appears that this is an int, not a long. Is
>>> there any other straightforward way to generate ids using ZooKeeper?