Closed git-hulk closed 10 months ago
@git-hulk I have some question about etcd storage.
In this code:
When should we send true
to e.leaderChangeCh
, and when should we send false
?
https://github.com/apache/kvrocks-controller/blob/unstable/storage/persistence/etcd/etcd.go#L265-L277
I'm not very familiar with the Go language, but it seems like this continue
is unnecessary.
https://github.com/apache/kvrocks-controller/blob/unstable/storage/persistence/etcd/etcd.go#L271-L273
I would greatly appreciate it if you could help me answer my questions.
I'm not very familiar with the Go language, but it seems like this continue is unnecessary.
It's indeed a bug that Line 270 should be after #L271-L273. That said don't emit leader change even if the leader is not changed.
When should we send true to e.leaderChangeCh, and when should we send false?
For the initial design intention, we would like to send true
to the channel if the leader is changed, and false
if any other events. But from the current implementation, it doesn't care about the value of the channel and always checks if the leader has been changed.
For the zookeeper, it should be a bit simpler than the ETCD. Just create an ephemeral node to watch and try to create if the node does not exist.
I want to have a try. Can I use go-zookeeper/zk as Zookeeper client?