-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 leader info repopulation #6167
Conversation
* Change how we populate and clear leader UUID. This fixes a case where if a standby disconnects from an active node and reconnects, without the active node restarting, the UUID doesn't change so triggers on a new active node don't get run. * Add a bunch of test helpers and minor updates to things.
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.
Looks good!
import "golang.org/x/crypto/blake2b" | ||
|
||
func Blake2b256Hash(key string) []byte { | ||
hf, _ := blake2b.New256(nil) |
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.
The error being dropped here made me a little nervous at first, but I played with it and tested it out and agree that's the way to go.
@@ -108,28 +108,41 @@ func (c *Core) Leader() (isLeader bool, leaderAddr, clusterAddr string, err erro | |||
return false, "", "", nil | |||
} | |||
|
|||
c.clusterLeaderParamsLock.RLock() | |||
localLeaderUUID := c.clusterLeaderUUID |
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.
Can we now remove these values from Core?
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.
Ah yeah
1b68542
Change how we populate and clear leader UUID. This fixes a case where
if a standby disconnects from an active node and reconnects, without the
active node restarting, the UUID doesn't change so triggers on a new
active node don't get run.
Add a bunch of test helpers and minor updates to things.