Fix bug that heartbeat error msg may be null (#574)
This commit is contained in:
@ -704,7 +704,9 @@ public class SchemaChangeJob extends AlterJob {
|
||||
}
|
||||
|
||||
if (replica.getLastFailedVersion() > 0) {
|
||||
-- healthNum;
|
||||
LOG.warn("replica {} of tablet {} last failed version > 0, set it as bad",
|
||||
replica, tablet.getId());
|
||||
--healthNum;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,7 +324,7 @@ public class BrokerMgr {
|
||||
row.add(String.valueOf(broker.isAlive));
|
||||
row.add(TimeUtils.longToTimeString(broker.lastStartTime));
|
||||
row.add(TimeUtils.longToTimeString(broker.lastUpdateTime));
|
||||
row.add(broker.msg);
|
||||
row.add(broker.heartbeatErrMsg);
|
||||
result.addRow(row);
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ public class FsBroker implements Writable, Comparable<FsBroker> {
|
||||
public String ip;
|
||||
public int port;
|
||||
// msg for ping result
|
||||
public String msg;
|
||||
public String heartbeatErrMsg = "";
|
||||
public long lastUpdateTime;
|
||||
public long lastStartTime = -1;
|
||||
|
||||
@ -59,13 +59,13 @@ public class FsBroker implements Writable, Comparable<FsBroker> {
|
||||
lastStartTime = hbResponse.getHbTime();
|
||||
}
|
||||
lastUpdateTime = hbResponse.getHbTime();
|
||||
msg = "";
|
||||
heartbeatErrMsg = "";
|
||||
} else {
|
||||
if (isAlive) {
|
||||
isAlive = false;
|
||||
isChanged = true;
|
||||
}
|
||||
msg = hbResponse.getMsg();
|
||||
heartbeatErrMsg = hbResponse.getMsg() == null ? "Unknown error" : hbResponse.getMsg();
|
||||
}
|
||||
|
||||
return isChanged;
|
||||
|
||||
@ -349,7 +349,7 @@ public class Replica implements Writable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer strBuffer = new StringBuffer("replicaId=");
|
||||
StringBuffer strBuffer = new StringBuffer("[replicaId=");
|
||||
strBuffer.append(id);
|
||||
strBuffer.append(", BackendId=");
|
||||
strBuffer.append(backendId);
|
||||
@ -373,6 +373,7 @@ public class Replica implements Writable {
|
||||
strBuffer.append(lastFailedTimestamp);
|
||||
strBuffer.append(", schemaHash");
|
||||
strBuffer.append(schemaHash);
|
||||
strBuffer.append("]");
|
||||
return strBuffer.toString();
|
||||
}
|
||||
|
||||
|
||||
@ -743,6 +743,6 @@ public class Config extends ConfigBase {
|
||||
* if set to true, TabletScheduler will not do balance.
|
||||
*/
|
||||
@ConfField(mutable = true, masterOnly = true)
|
||||
public static boolean disable_balance = false; // 10%
|
||||
public static boolean disable_balance = false;
|
||||
}
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ public class FrontendsProcNode implements ProcNodeInterface {
|
||||
|
||||
info.add(String.valueOf(isHelperNode(helperNodes, fe)));
|
||||
|
||||
info.add(fe.getMsg());
|
||||
info.add(fe.getHeartbeatErrMsg());
|
||||
|
||||
infos.add(info);
|
||||
}
|
||||
|
||||
@ -566,7 +566,7 @@ public class Backend implements Writable {
|
||||
LOG.info("{} is dead,", this.toString());
|
||||
}
|
||||
|
||||
heartbeatErrMsg = hbResponse.getMsg();
|
||||
heartbeatErrMsg = hbResponse.getMsg() == null ? "Unknown error" : hbResponse.getMsg();
|
||||
}
|
||||
|
||||
return isChanged;
|
||||
|
||||
@ -40,7 +40,7 @@ public class Frontend implements Writable {
|
||||
|
||||
private long replayedJournalId;
|
||||
private long lastUpdateTime;
|
||||
private String msg = "";
|
||||
private String heartbeatErrMsg = "";
|
||||
|
||||
private boolean isAlive = false;
|
||||
|
||||
@ -101,8 +101,8 @@ public class Frontend implements Writable {
|
||||
return replayedJournalId;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
public String getHeartbeatErrMsg() {
|
||||
return heartbeatErrMsg;
|
||||
}
|
||||
|
||||
public long getLastUpdateTime() {
|
||||
@ -123,14 +123,14 @@ public class Frontend implements Writable {
|
||||
rpcPort = hbResponse.getRpcPort();
|
||||
replayedJournalId = hbResponse.getReplayedJournalId();
|
||||
lastUpdateTime = hbResponse.getHbTime();
|
||||
msg = "";
|
||||
heartbeatErrMsg = "";
|
||||
isChanged = true;
|
||||
} else {
|
||||
if (isAlive) {
|
||||
isAlive = false;
|
||||
isChanged = true;
|
||||
}
|
||||
msg = hbResponse.getMsg();
|
||||
heartbeatErrMsg = hbResponse.getMsg() == null ? "Unknown error" : hbResponse.getMsg();
|
||||
}
|
||||
return isChanged;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user