From 2f4106eb27914b5dc372a9ffbf70e39d6c7624ab Mon Sep 17 00:00:00 2001 From: Colin McIntosh Date: Wed, 1 Sep 2021 14:54:31 -0400 Subject: [PATCH] Fix an issue where negative lock sequence numbers are incorrectly made positive. --- gateway/locking/zookeeper.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gateway/locking/zookeeper.go b/gateway/locking/zookeeper.go index 6b9028e..82cd6a6 100644 --- a/gateway/locking/zookeeper.go +++ b/gateway/locking/zookeeper.go @@ -102,7 +102,7 @@ func (l *ZookeeperNonBlockingLock) ID() string { } func parseSeq(path string) (int, error) { - parts := strings.Split(path, "-") + parts := strings.Split(path, ":") return strconv.Atoi(parts[len(parts)-1]) } @@ -127,7 +127,7 @@ func (l *ZookeeperNonBlockingLock) try() (bool, error) { return true, zk.ErrDeadlock } - prefix := fmt.Sprintf("%s/lock-", l.id) + prefix := fmt.Sprintf("%s/lock:", l.id) // Attempt to add a sequence to the tree path, err := l.conn.CreateProtectedEphemeralSequential(prefix, []byte(l.member), l.acl)