Fix health check when disconnect to etcd (#12292)

Signed-off-by: dragondriver <jiquan.long@zilliz.com>
pull/12302/head
dragondriver 2021-11-26 11:39:16 +08:00 committed by GitHub
parent 080eaa9a5c
commit b6d0150dc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 0 deletions

View File

@ -84,5 +84,15 @@ func (handler *componentsHealthzHandler) ServeHTTP(w http.ResponseWriter, r *htt
return
}
if states.State == nil {
unhealthyHandler(w, r, "failed to get state")
return
}
if states.State.StateCode != internalpb.StateCode_Healthy {
unhealthyHandler(w, r, fmt.Sprintf("state: %s", states.State.StateCode.String()))
return
}
healthyHandler(w, r)
}

View File

@ -644,6 +644,10 @@ func (node *DataNode) Stop() error {
}
node.session.Revoke(time.Second)
// https://github.com/milvus-io/milvus/issues/12282
node.UpdateStateCode(internalpb.StateCode_Abnormal)
return nil
}

View File

@ -282,6 +282,10 @@ func (i *IndexCoord) Stop() error {
cb()
}
i.session.Revoke(time.Second)
// https://github.com/milvus-io/milvus/issues/12282
i.UpdateStateCode(internalpb.StateCode_Abnormal)
return nil
}

View File

@ -223,6 +223,10 @@ func (i *IndexNode) Stop() error {
cb()
}
i.session.Revoke(time.Second)
// https://github.com/milvus-io/milvus/issues/12282
i.UpdateStateCode(internalpb.StateCode_Abnormal)
log.Debug("Index node stopped.")
return nil
}

View File

@ -369,6 +369,9 @@ func (node *Proxy) Stop() error {
node.session.Revoke(time.Second)
// https://github.com/milvus-io/milvus/issues/12282
node.UpdateStateCode(internalpb.StateCode_Abnormal)
return nil
}