Skip to content

Commit

Permalink
[WIP] Revert last commit to test jepsen
Browse files Browse the repository at this point in the history
This reverts commit 4e7c8f2.
  • Loading branch information
noname0443 committed Sep 24, 2024
1 parent 4e7c8f2 commit 6aef2cc
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions internal/dcs/zk.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"net"
"os"
"slices"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -158,30 +157,12 @@ func (z *zkDCS) getSelfLockOwner() LockOwner {
func (z *zkDCS) makePath(path string) error {
parts := strings.Split(path, sep)
prefix := ""
var paths []string
for _, part := range parts {
if part == "" {
continue
}
prefix = JoinPath(prefix, part)
paths = append(paths, prefix)
}
slices.Reverse(paths)
var createPaths []string
for _, path := range paths {
_, _, err := z.retryGet(path)
if err == nil {
break
}
if err == zk.ErrNoNode {
createPaths = append(createPaths, path)
} else {
return err
}
}
slices.Reverse(createPaths)
for _, path := range createPaths {
_, err := z.retryCreate(path, []byte{}, 0, z.acl)
_, err := z.retryCreate(prefix, []byte{}, 0, z.acl)
if err != nil && err != zk.ErrNodeExists {
return err
}
Expand Down

0 comments on commit 6aef2cc

Please sign in to comment.