go-zookeeper icon indicating copy to clipboard operation
go-zookeeper copied to clipboard

Update Lock Implementation using GUIDs

Open gkalele opened this issue 9 years ago • 2 comments

Looking at the implemention in lock.go and comparing with the Lock recipe from the Zookeeper recipes page, it appears that they now recomment creating lock nodes with a prefix of <GUID>-lock- instead of just lock- to handle a special case.

https://zookeeper.apache.org/doc/trunk/recipes.html#sc_recipes_Locks

Call create( ) with a pathname of "_locknode_/guid-lock-" and the sequence and ephemeral flags set. The guid is needed in case the create() result is missed. See the note below.

gkalele avatar Oct 24 '16 18:10 gkalele

Does the current implementation in https://github.com/samuel/go-zookeeper/blob/master/zk/lock.go even follow one of the "official" lock recipes? There are no code comments indicating that as far as I can see. Would be good to know exactly what the goal was so that it's easier to decide what a bug is and what not.

jgehrcke avatar Sep 03 '18 10:09 jgehrcke

@gkalele, #209 now allows for custom lock names based on a lock name builder. Does that fit your usecase?

MrWinstead avatar Jan 25 '19 17:01 MrWinstead