-
Notifications
You must be signed in to change notification settings - Fork 74
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
Simplified barrier logic #127
Simplified barrier logic #127
Conversation
select { | ||
case <-zkMemberJoinedWatcher: | ||
continue | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this select also have a case <-stopChan? It looks it might block here indefinitely
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good thinking. I've added the case <- stopChan on the inner select statement.
Merge pull request #126 from CrowdStrike/more-zk-logging
…one host cannot reach consesus on a state barrier and gets stuck in a loop.
// Haven't seen all expected consumers on this barrier path. Watch for changes to the path... | ||
select { | ||
case <-stopChan: | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suppose we should have that blackhole function to read from zkMemberJoinedWatcher here as well. Consider a following case: we create a zkMemberJoinedWatcher and hit the barrier timeout; the stopChan receives a value but then a member joins; zk lib tries to write to zkMemberJoinedWatcher but no one listens to it anymore. At this point zk lib would probably block indefinitely.
Made the logic for how we await on a state barrier easier.
The client first creates/joins the barrier in a blocking call. Afterwards we kick off a go routine that loops with a zkwatcher on the barrier zkNode and doesn't notify the AwaitOnStateBarrier func until either it sees all expected clients or gets an error.