Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

Fix: Exists() should always return false when an error happenning and FLW parsing enhancement #246

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion zk/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -1138,8 +1138,10 @@ func (c *Conn) Exists(path string) (bool, *Stat, error) {
res := &existsResponse{}
_, err := c.request(opExists, &existsRequest{Path: path, Watch: false}, res, nil)
exists := true
if err == ErrNoNode {
if err != nil {
exists = false
}
if err == ErrNoNode {
err = nil
}
return exists, &res.Stat, err
Expand Down
2 changes: 1 addition & 1 deletion zk/flw.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func FLWSrvr(servers []string, timeout time.Duration) ([]*ServerStats, bool) {
// different parts of the regular expression that are required to parse the srvr output
const (
zrVer = `^Zookeeper version: ([A-Za-z0-9\.\-]+), built on (\d\d/\d\d/\d\d\d\d \d\d:\d\d [A-Za-z0-9:\+\-]+)`
zrLat = `^Latency min/avg/max: (\d+)/(\d+)/(\d+)`
zrLat = `^Latency min/avg/max: (\d+(\.\d+)?)/(\d+(\.\d+)?)/(\d+(\.\d+)?)`
zrNet = `^Received: (\d+).*\n^Sent: (\d+).*\n^Connections: (\d+).*\n^Outstanding: (\d+)`
zrState = `^Zxid: (0x[A-Za-z0-9]+).*\n^Mode: (\w+).*\n^Node count: (\d+)`
)
Expand Down