You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issues-translate-bot
changed the title
contrib/registry/zookeeper: 服务多实例,会删除之前的注册信息
contrib/registry/zookeeper: Service multiple instances will delete the previous registration information
Feb 11, 2025
fengpengyun
changed the title
contrib/registry/zookeeper: Service multiple instances will delete the previous registration information
contrib/registry/zookeeper: 服务多实例,会删除之前的注册信息
Feb 11, 2025
Go version
go version go1.23.4 windows/amd64
GoFrame version
2.8.3
Can this bug be reproduced with the latest release?
Option Yes
What did you do?
``
gsvc.SetRegistry(zookeeper.New(
[]string{"127.0.0.1:2181"}, zookeeper.WithRootPath("/gogf"),
))
`
What did you see happen?
zookeeper_register.go
``
// ensureName ensure node exists, if not exist, create and set data
func (r *Registry) ensureName(path string, data []byte, flags int32) error {
exists, stat, err := r.conn.Exists(path)
if err != nil {
return gerror.Wrapf(err,
"Error with check node exist which name is %s",
path,
)
}
// ephemeral nodes handling after restart
// fixes a race condition if the server crashes without using CreateProtectedEphemeralSequential()
if flags&zk.FlagEphemeral == zk.FlagEphemeral {
// 此处会删除 原有server name对应的node节点
err = r.conn.Delete(path, stat.Version)
if err != nil && err != zk.ErrNoNode {
return gerror.Wrapf(err,
"Error with delete node which name is %s",
path,
)
}
exists = false
}
if !exists {
if len(r.opts.user) > 0 && len(r.opts.password) > 0 {
_, err = r.conn.Create(path, data, flags, zk.DigestACL(zk.PermAll, r.opts.user, r.opts.password))
} else {
_, err = r.conn.Create(path, data, flags, zk.WorldACL(zk.PermAll))
}
if err != nil {
return gerror.Wrapf(err,
"Error with create node which name is %s",
path,
)
}
}
return nil
}
`
What did you expect to see?
保留原有的server name node节点,endpoints对应添加
The text was updated successfully, but these errors were encountered: