Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: GetNextId in ZK component throw zk: node does not exist #752

Merged
merged 5 commits into from
Aug 5, 2022
Merged
Changes from 3 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
7 changes: 7 additions & 0 deletions components/sequencer/zookeeper/zookeeper_sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ func (s *ZookeeperSequencer) GetNextId(req *sequencer.GetNextIdRequest) (*sequen
stat, err := s.client.Set("/"+req.Key, []byte(""), -1)

if err != nil {
if err == zk.ErrNoNode {
_, err1 := s.client.Create("/"+req.Key, []byte(""), zk.FlagEphemeral, zk.WorldACL(zk.PermAll))
bxiiiiii marked this conversation as resolved.
Show resolved Hide resolved
if err1 != nil {
return nil, err1
}
return s.GetNextId(req)
}
return nil, err
}
// create node version=0, every time we set node will result in version+1
Expand Down