Use the incoming request version to populate follower state (#15806)

This commit is contained in:
Josh Black 2022-06-06 08:44:24 -07:00 committed by GitHub
parent 54b6cb9afe
commit 9c48c62d6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -195,6 +195,7 @@ type EchoRequestUpdate struct {
Term uint64
DesiredSuffrage string
UpgradeVersion string
SDKVersion string
RedundancyZone string
}
@ -212,7 +213,7 @@ func NewFollowerStates() *FollowerStates {
}
}
// Update the peer information in the follower states
// Update the peer information in the follower states. Note that this function runs on the active node.
func (s *FollowerStates) Update(req *EchoRequestUpdate) {
s.l.Lock()
defer s.l.Unlock()
@ -230,7 +231,7 @@ func (s *FollowerStates) Update(req *EchoRequestUpdate) {
state.LastTerm = req.Term
state.DesiredSuffrage = req.DesiredSuffrage
state.LastHeartbeat = time.Now()
state.Version = version.GetVersion().Version
state.Version = req.SDKVersion
state.UpgradeVersion = req.UpgradeVersion
state.RedundancyZone = req.RedundancyZone
}

View File

@ -98,6 +98,7 @@ func (s *forwardedRequestRPCServer) Echo(ctx context.Context, in *EchoRequest) (
AppliedIndex: in.RaftAppliedIndex,
Term: in.RaftTerm,
DesiredSuffrage: in.RaftDesiredSuffrage,
SDKVersion: in.SdkVersion,
UpgradeVersion: in.RaftUpgradeVersion,
RedundancyZone: in.RaftRedundancyZone,
})