wvanbergen / kazoo-go

Go library to access Kafka metadata in Zookeeper
http://godoc.org/github.com/wvanbergen/kazoo-go
MIT License
100 stars 48 forks source link

Report registration errors consistently #37

Closed horkhe closed 6 years ago

horkhe commented 6 years ago

Registration related functions have been returning inconsistently either kazoo specific errors ErrInstanceAlreadyRegistered and ErrInstanceNotRegistered, or zookeeper-go errors zk.ErrNoNode and zk.ErrNodeExists.

Unfortunately it is impossible to fix this issue without breaking backwards compatibility with users that expect either of those errors. Nonetheless I suggest all the registration related function to return kazoo specific errors consistently.

Note that some of the fixed cases almost impossible to reproduce, because they address subtle race that can occur between Get and subsequent Set.

horkhe commented 6 years ago

@wvanbergen could you please take a look.