Commit 38b95f0c authored by Hong Zhiguo's avatar Hong Zhiguo

fix LeaderTransitions always zero

on leader transition, LeaderTransitions is increased to 1, but then cleared to zero by next renew. External monitoring system may watch LeaderTransitions and rely on it's facticity.
parent fbe2d15f
......@@ -253,6 +253,7 @@ func (le *LeaderElector) tryAcquireOrRenew() bool {
// here. Let's correct it before updating.
if oldLeaderElectionRecord.HolderIdentity == le.config.Lock.Identity() {
leaderElectionRecord.AcquireTime = oldLeaderElectionRecord.AcquireTime
leaderElectionRecord.LeaderTransitions = oldLeaderElectionRecord.LeaderTransitions
} else {
leaderElectionRecord.LeaderTransitions = oldLeaderElectionRecord.LeaderTransitions + 1
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment