Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no way to create sequential nodes with no prefix under a chroot #77

Closed
igor47 opened this issue Feb 5, 2014 · 1 comment
Closed

no way to create sequential nodes with no prefix under a chroot #77

igor47 opened this issue Feb 5, 2014 · 1 comment

Comments

@igor47
Copy link

igor47 commented Feb 5, 2014

lets say that i want to create a series of ephemeral nodes that look like this: /test/service/00001, /test/service/00002, etc...

first, i can't set my chroot to /test/service/ :

irb(main):002:0> zk = ZK.new('localhost:2181/test/service/')
ZK::Exceptions::BadArguments: inputs: {:path=>"/test/service/", :ignore=>:no_node}

so, i'll leave out the trailing slash:

zk = ZK.new('localhost:2181/test/service')
irb(main):005:0> zk.create('', :data => 'hi', :mode => :ephemeral_sequential)
=> "0000000001"

however, this node is not under the /test/service dir, it's under /test and is called /test/service00000000001:

[zk: localhost:2181(CONNECTED) 5] ls /test
[service, service0000000001]

the same situation occurs if i try to use '/' as the path:

irb(main):006:0> zk.create('/', :data => 'hi', :mode => :ephemeral_sequential)
=> "0000000002"
[zk: localhost:2181(CONNECTED) 6] ls /test
[service0000000002, service, service0000000001]

i DO get the correct result if i use '/0' as the path, but i'm not sure if this is safe to do; what happens when the sequential id wraps? does it just get another digit?

irb(main):007:0> zk.create('/0', :data => 'hi', :mode => :ephemeral_sequential)
=> "/00000000000"
[zk: localhost:2181(CONNECTED) 8] ls /test/service
[00000000000]
@igor47
Copy link
Author

igor47 commented Feb 5, 2014

this looks like an upstream bug, since i was able to reproduce it with just the zookeeper gem. no sense looking at it here, so closing in favor of zk-ruby/zookeeper#58

@igor47 igor47 closed this as completed Feb 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant