[ISSUE #5927] Init health check status when loading snapshot of persistent instances. (#5928)

This commit is contained in:
Pixy Yuan 2021-06-03 09:35:01 +08:00 committed by GitHub
parent 9ab1d62a06
commit 07f38a4763
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 11 deletions

View File

@ -112,15 +112,17 @@ public class IpPortBasedClient extends AbstractClient {
}
private HealthCheckInstancePublishInfo parseToHealthCheckInstance(InstancePublishInfo instancePublishInfo) {
HealthCheckInstancePublishInfo result;
if (instancePublishInfo instanceof HealthCheckInstancePublishInfo) {
return (HealthCheckInstancePublishInfo) instancePublishInfo;
result = (HealthCheckInstancePublishInfo) instancePublishInfo;
} else {
result = new HealthCheckInstancePublishInfo();
result.setIp(instancePublishInfo.getIp());
result.setPort(instancePublishInfo.getPort());
result.setHealthy(instancePublishInfo.isHealthy());
result.setCluster(instancePublishInfo.getCluster());
result.setExtendDatum(instancePublishInfo.getExtendDatum());
}
HealthCheckInstancePublishInfo result = new HealthCheckInstancePublishInfo();
result.setIp(instancePublishInfo.getIp());
result.setPort(instancePublishInfo.getPort());
result.setHealthy(instancePublishInfo.isHealthy());
result.setCluster(instancePublishInfo.getCluster());
result.setExtendDatum(instancePublishInfo.getExtendDatum());
if (!ephemeral) {
result.initHealthCheck();
}

View File

@ -98,12 +98,12 @@ public class HealthCheckTaskV2 extends AbstractExecuteTask implements NacosHealt
ClusterMetadata metadata = getClusterMetadata(each, instancePublishInfo);
ApplicationUtils.getBean(HealthCheckProcessorV2Delegate.class).process(this, each, metadata);
if (Loggers.EVT_LOG.isDebugEnabled()) {
Loggers.EVT_LOG.debug("[HEALTH-CHECK] schedule health check task: {}", client.getClientId());
Loggers.EVT_LOG.debug("[HEALTH-CHECK-V2] schedule health check task: {}", client.getClientId());
}
}
}
} catch (Throwable e) {
Loggers.SRV_LOG.error("[HEALTH-CHECK] error while process health check for {}", client.getClientId(), e);
Loggers.SRV_LOG.error("[HEALTH-CHECK-V2] error while process health check for {}", client.getClientId(), e);
} finally {
if (!cancelled) {
HealthCheckReactor.scheduleCheck(this);

View File

@ -101,7 +101,7 @@ public class TcpHealthCheckProcessor implements HealthCheckProcessorV2, Runnable
}
// TODO handle marked(white list) logic like v1.x.
if (!instance.tryStartCheck()) {
SRV_LOG.warn("tcp check started before last one finished, service: {} : {} : {}:{}",
SRV_LOG.warn("[HEALTH-CHECK-V2] tcp check started before last one finished, service: {} : {} : {}:{}",
service.getGroupedServiceName(), instance.getCluster(), instance.getIp(), instance.getPort());
healthCheckCommon
.reEvaluateCheckRT(task.getCheckRtNormalized() * 2, task, switchDomain.getTcpHealthParams());
@ -151,7 +151,7 @@ public class TcpHealthCheckProcessor implements HealthCheckProcessorV2, Runnable
GlobalExecutor.executeTcpSuperSense(new PostProcessor(key));
}
} catch (Throwable e) {
SRV_LOG.error("[HEALTH-CHECK] error while processing NIO task", e);
SRV_LOG.error("[HEALTH-CHECK-V2] error while processing NIO task", e);
}
}
}