server: Extract triggerCorruptAlarm to function

Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
This commit is contained in:
Marek Siarkowicz 2022-06-13 13:56:52 +02:00
parent 144f445838
commit 70fbc0b3e7

View File

@ -174,14 +174,7 @@ func (s *EtcdServer) checkHashKV() error {
return
}
alarmed = true
a := &pb.AlarmRequest{
MemberID: id,
Action: pb.AlarmRequest_ACTIVATE,
Alarm: pb.AlarmType_CORRUPT,
}
s.GoAttach(func() {
s.raftRequest(s.ctx, pb.InternalRaftRequest{Alarm: a})
})
s.triggerCorruptAlarm(id)
}
if h2 != h && rev2 == rev && crev == crev2 {
@ -244,6 +237,17 @@ func (s *EtcdServer) checkHashKV() error {
return nil
}
func (s *EtcdServer) triggerCorruptAlarm(id uint64) {
a := &pb.AlarmRequest{
MemberID: id,
Action: pb.AlarmRequest_ACTIVATE,
Alarm: pb.AlarmType_CORRUPT,
}
s.GoAttach(func() {
s.raftRequest(s.ctx, pb.InternalRaftRequest{Alarm: a})
})
}
type peerInfo struct {
id types.ID
eps []string