Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix duplicate log #3854

Merged
merged 1 commit into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,14 @@ public void updateLastReceivedQryTime() {
}

private void setTimeout() {
LOGGER.warn("delayDetection to [" + source.getDbGroupConfig().getName() + ":" + source.getConfig().getUrl() + ":" + source.getConfig().getUrl() + "] setTimeout");
LOGGER.warn("delayDetection to [" + source.getDbGroupConfig().getName() + ":" + source.getConfig().getInstanceName() + ":" + source.getConfig().getUrl() + "] setTimeout");
delayDetectionStatus = DelayDetectionStatus.TIMEOUT;
source.setDelayDetectionStatus(delayDetectionStatus);
alert(AlarmCode.DB_SLAVE_INSTANCE_DELAY, errorMessage, dbGroupConfig.instanceDatabaseType().name().toLowerCase());
}

private void setError() {
LOGGER.warn("delayDetection to [" + source.getDbGroupConfig().getName() + ":" + source.getConfig().getUrl() + ":" + source.getConfig().getUrl() + "] setError");
LOGGER.warn("delayDetection to [" + source.getDbGroupConfig().getName() + ":" + source.getConfig().getInstanceName() + ":" + source.getConfig().getUrl() + "] setError");
delayDetectionStatus = DelayDetectionStatus.ERROR;
source.setDelayDetectionStatus(delayDetectionStatus);
if (!source.isReadInstance()) {
Expand All @@ -245,7 +245,7 @@ private void setError() {
}

private void setOk() {
LOGGER.debug("delayDetection to [" + source.getDbGroupConfig().getName() + ":" + source.getConfig().getUrl() + ":" + source.getConfig().getUrl() + "] setOK");
LOGGER.debug("delayDetection to [" + source.getDbGroupConfig().getName() + ":" + source.getConfig().getInstanceName() + ":" + source.getConfig().getUrl() + "] setOK");
if (errorCount.get() > 0) {
errorCount.set(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ public void start(long heartbeatPeriodMillis) {

public void stop(String reason) {
if (isStop) {
LOGGER.warn("heartbeat[{}] had been stop", source.getDbGroupConfig().getName() + ":" + source.getConfig().getUrl() + ":" + source.getConfig().getUrl());
LOGGER.warn("heartbeat[{}] had been stop", source.getDbGroupConfig().getName() + ":" + source.getConfig().getInstanceName() + ":" + source.getConfig().getUrl());
return;
}
LOGGER.info("stop heartbeat of instance[{}], due to {}", source.getDbGroupConfig().getName() + ":" + source.getConfig().getUrl() + ":" + source.getConfig().getUrl(), reason);
LOGGER.info("stop heartbeat of instance[{}], due to {}", source.getDbGroupConfig().getName() + ":" + source.getConfig().getInstanceName() + ":" + source.getConfig().getUrl(), reason);
isStop = true;
scheduledFuture.cancel(false);
initHeartbeat.set(false);
Expand Down Expand Up @@ -164,7 +164,7 @@ boolean doHeartbeatRetry() {
}

void setErrorResult(String errMsg) {
LOGGER.warn("heartbeat to [" + source.getDbGroupConfig().getName() + ":" + source.getConfig().getUrl() + ":" + source.getConfig().getUrl() + "] setError");
LOGGER.warn("heartbeat to [" + source.getDbGroupConfig().getName() + ":" + source.getConfig().getInstanceName() + ":" + source.getConfig().getUrl() + "] setError");
// should continue checking error status
if (detector != null) {
detector.quit();
Expand Down Expand Up @@ -203,7 +203,7 @@ void setResult(MySQLHeartbeatStatus result) {

private void setOk() {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("heartbeat to [" + source.getDbGroupConfig().getName() + ":" + source.getConfig().getUrl() + ":" + source.getConfig().getUrl() + "] setOK");
LOGGER.debug("heartbeat to [" + source.getDbGroupConfig().getName() + ":" + source.getConfig().getInstanceName() + ":" + source.getConfig().getUrl() + "] setOK");
}
MySQLHeartbeatStatus previousStatus = status;
switch (status) {
Expand All @@ -212,17 +212,17 @@ private void setOk() {
this.errorCount.set(0);
this.startErrorTime.set(-1);
if (isStop) {
LOGGER.warn("heartbeat[{}] had been stop", source.getDbGroupConfig().getName() + ":" + source.getConfig().getUrl() + ":" + source.getConfig().getUrl());
LOGGER.warn("heartbeat[{}] had been stop", source.getDbGroupConfig().getName() + ":" + source.getConfig().getInstanceName() + ":" + source.getConfig().getUrl());
detector.quit();
} else {
LOGGER.info("heartbeat to [{}] setOk, previous status is timeout", source.getDbGroupConfig().getName() + ":" + source.getConfig().getUrl() + ":" + source.getConfig().getUrl());
LOGGER.info("heartbeat to [{}] setOk, previous status is timeout", source.getDbGroupConfig().getName() + ":" + source.getConfig().getInstanceName() + ":" + source.getConfig().getUrl());
heartbeat(); // timeout, heart beat again
}
break;
case OK:
break;
default:
LOGGER.info("heartbeat to [{}] setOk, previous status is {}", source.getDbGroupConfig().getName() + ":" + source.getConfig().getUrl() + ":" + source.getConfig().getUrl(), status);
LOGGER.info("heartbeat to [{}] setOk, previous status is {}", source.getDbGroupConfig().getName() + ":" + source.getConfig().getInstanceName() + ":" + source.getConfig().getUrl(), status);
this.status = MySQLHeartbeatStatus.OK;
this.errorCount.set(0);
this.startErrorTime.set(-1);
Expand All @@ -236,7 +236,7 @@ private void setOk() {
source.updatePoolCapacity();
}
if (isStop) {
LOGGER.warn("heartbeat[{}] had been stop", source.getDbGroupConfig().getName() + ":" + source.getConfig().getUrl() + ":" + source.getConfig().getUrl());
LOGGER.warn("heartbeat[{}] had been stop", source.getDbGroupConfig().getName() + ":" + source.getConfig().getInstanceName() + ":" + source.getConfig().getUrl());
detector.quit();
}
}
Expand All @@ -253,10 +253,10 @@ private void recordErrorCount() {

private void setTimeout() {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("heartbeat to [" + source.getDbGroupConfig().getName() + ":" + source.getConfig().getUrl() + ":" + source.getConfig().getUrl() + "] setTimeout");
LOGGER.debug("heartbeat to [" + source.getDbGroupConfig().getName() + ":" + source.getConfig().getInstanceName() + ":" + source.getConfig().getUrl() + "] setTimeout");
}
if (status != MySQLHeartbeatStatus.TIMEOUT) {
LOGGER.warn("heartbeat to [{}] setTimeout, previous status is {}", source.getDbGroupConfig().getName() + ":" + source.getConfig().getUrl() + ":" + source.getConfig().getUrl(), status);
LOGGER.warn("heartbeat to [{}] setTimeout, previous status is {}", source.getDbGroupConfig().getName() + ":" + source.getConfig().getInstanceName() + ":" + source.getConfig().getUrl(), status);
status = MySQLHeartbeatStatus.TIMEOUT;
}
}
Expand Down
Loading