Thanks mahadev, that's a simple and elegant solution. I feel pretty dumb not thinking of it myself! :( it should be very straightforward to implement too. We were using a database to store blobs and to generate ids. I replaced the blob storage with hadoop hdfs and the ids with zookeeper. Nice work you hadoop guys! :)

Sent from my iPhone

On Apr 23, 2009, at 5:26 PM, Mahadev Konar <maha...@yahoo-inc.com> wrote:

Hi Satish,
Most of the sequences (versions of nodes ) and the sequence flags are ints.
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.

Mahadev

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 our application. I was thinking about using ZooKeeper instead so I can get rid of the database. My plan was to use the sequential id from ephemeral nodes, 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?
Thanks,

Satish

Reply via email to