mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
backport from #13467 exclude the same alarm type activated by multiple peers
This commit is contained in:
parent
72d3e382e7
commit
04d47a93f9
@ -117,8 +117,7 @@ func checkHealth(srv etcdserver.ServerV2, excludedAlarms AlarmSet) Health {
|
||||
for _, v := range as {
|
||||
alarmName := v.Alarm.String()
|
||||
if _, found := excludedAlarms[alarmName]; found {
|
||||
plog.Debugf("/health excluded alarm %s", alarmName)
|
||||
delete(excludedAlarms, alarmName)
|
||||
plog.Debugf("/health excluded alarm %s", v.String())
|
||||
continue
|
||||
}
|
||||
h.Health = "false"
|
||||
@ -127,10 +126,6 @@ func checkHealth(srv etcdserver.ServerV2, excludedAlarms AlarmSet) Health {
|
||||
}
|
||||
}
|
||||
|
||||
if len(excludedAlarms) > 0 {
|
||||
plog.Warningf("fail exclude alarms from health check, exclude alarms %+v", excludedAlarms)
|
||||
}
|
||||
|
||||
if h.Health == "true" {
|
||||
if uint64(srv.Leader()) == raft.None {
|
||||
h.Health = "false"
|
||||
|
@ -91,6 +91,12 @@ func TestHealthHandler(t *testing.T) {
|
||||
http.StatusOK,
|
||||
"true",
|
||||
},
|
||||
{
|
||||
[]*pb.AlarmMember{{MemberID: uint64(1), Alarm: pb.AlarmType_NOSPACE}, {MemberID: uint64(2), Alarm: pb.AlarmType_NOSPACE}, {MemberID: uint64(3), Alarm: pb.AlarmType_NOSPACE}},
|
||||
"/health?exclude=NOSPACE",
|
||||
http.StatusOK,
|
||||
"true",
|
||||
},
|
||||
{
|
||||
[]*pb.AlarmMember{{MemberID: uint64(0), Alarm: pb.AlarmType_NOSPACE}, {MemberID: uint64(1), Alarm: pb.AlarmType_CORRUPT}},
|
||||
"/health?exclude=NOSPACE",
|
||||
|
Loading…
x
Reference in New Issue
Block a user