use of com.cubrid.cubridmanager.core.mondashboard.model.DbProcessStatusInfo in project cubrid-manager by CUBRID.
the class DatabaseDashboardViewPart method updateProcessStat.
/**
* Update process statistic value
*
*/
private void updateProcessStat() {
if (dbNode.getHaDatabaseStatus() == null || dbNode.getHaDatabaseStatus().getDbServerProcessStatus() == null) {
dbServerStatusValue.setText("");
} else {
String str = dbNode.getHaDatabaseStatus().getDbServerProcessStatus().getProcessStatus().getText();
dbServerStatusValue.setText(str);
}
DbProcessStatusInfo copyLogDbProcessStatusInfo = HAUtil.getActiveCopyLogDbProcessStatusInfo(dbNode);
if (copyLogDbProcessStatusInfo == null) {
copyLogValue.setText("");
} else {
copyLogValue.setText(copyLogDbProcessStatusInfo.getProcessStatus().getText());
}
DbProcessStatusInfo applyLogDbProcessStatusInfo = HAUtil.getActiveApplyLogDbProcessStatusInfo(dbNode);
if (applyLogDbProcessStatusInfo == null) {
applyLogValue.setText("");
} else {
applyLogValue.setText(applyLogDbProcessStatusInfo.getProcessStatus().getText());
}
}
use of com.cubrid.cubridmanager.core.mondashboard.model.DbProcessStatusInfo in project cubrid-manager by CUBRID.
the class HAUtil method getSyncModeType.
/**
*
* Get sync mode from standby database node
*
* @param standbyNode DatabaseNode
* @param activeNode DatabaseNode
* @return SyncModeType
*/
public static SyncModeType getSyncModeType(DatabaseNode standbyNode, DatabaseNode activeNode) {
HADatabaseStatusInfo dbStatusInfo = standbyNode.getHaDatabaseStatus();
if (dbStatusInfo == null) {
return null;
}
DBStatusType dbStatusType = dbStatusInfo.getStatusType();
if (dbStatusType != DBStatusType.STANDBY && dbStatusType != DBStatusType.MAINTENANCE) {
return null;
}
List<DbProcessStatusInfo> dbProcessList = dbStatusInfo.getCopyLogDbProcessStatusList();
if (dbProcessList == null || dbProcessList.isEmpty()) {
return null;
}
HAHostStatusInfo hostStatusInfo = dbStatusInfo.getHaHostStatusInfo();
if (hostStatusInfo.getStatusType() != HostStatusType.SLAVE && hostStatusInfo.getStatusType() != HostStatusType.REPLICA) {
return null;
}
HAHostStatusInfo masterHostStatusInfo = hostStatusInfo.getMasterHostStatusInfo();
if (masterHostStatusInfo == null) {
return null;
}
String masterHostName = masterHostStatusInfo.getHostName();
String masterIp = masterHostStatusInfo.getIp();
if (!StringUtil.isIpEqual(activeNode.getParent().getIp(), masterIp)) {
return null;
}
for (DbProcessStatusInfo dbProcessStatusInfo : dbProcessList) {
String hostName = dbProcessStatusInfo.getHostName();
String dbName = dbProcessStatusInfo.getDbName();
if (masterHostName.equals(hostName) && dbName.equals(activeNode.getDbName())) {
return dbProcessStatusInfo.getMode();
}
}
return null;
}
use of com.cubrid.cubridmanager.core.mondashboard.model.DbProcessStatusInfo in project cubrid-manager by CUBRID.
the class GetHeartbeatNodeInfoTask method buildProcessList.
/**
*
* Parse the node and build DbProcessStatusInfo object
*
* @param parent The TreeNode
* @param dbStatus The HADatabaseStatusInfo
* @param type The String
*/
private void buildProcessList(TreeNode parent, HADatabaseStatusInfo dbStatus, String type) {
for (int i = 0; i < parent.childrenSize(); i++) {
TreeNode node = parent.getChildren().get(i);
if (node.getValue("open") == null) {
continue;
}
if (node.getValue("open").trim().equals("element")) {
String hostName = node.getValue("hostname");
String dbName = node.getValue("dbname");
String pid = node.getValue("pid");
String state = node.getValue("state");
String logPath = node.getValue("logpath");
String mode = node.getValue("mode");
DbProcessStatusInfo logDbProcessStatus = new DbProcessStatusInfo();
logDbProcessStatus.setHostName(hostName);
logDbProcessStatus.setDbName(dbName);
logDbProcessStatus.setPid(pid);
logDbProcessStatus.setLogPath(logPath);
logDbProcessStatus.setProcessStatus(ProcessStatusType.getType(state));
logDbProcessStatus.setMode(SyncModeType.getType(mode));
if ("applylogdb".equals(type)) {
dbStatus.addApplyLogDbProcessStatus(logDbProcessStatus);
} else if ("copylogdb".equals(type)) {
dbStatus.addCopyLogDbProcessStatus(logDbProcessStatus);
}
}
}
}
use of com.cubrid.cubridmanager.core.mondashboard.model.DbProcessStatusInfo in project cubrid-manager by CUBRID.
the class GetHeartbeatNodeInfoTask method buildHaServerList.
/**
*
* Parse the node and build HADatabaseStatus object
*
* @param parent The TreeNode
* @param currentHaHostStatus The HAHostStatus
*/
private void buildHaServerList(TreeNode parent, HAHostStatusInfo currentHaHostStatus) {
HADatabaseStatusInfo dbStatus = new HADatabaseStatusInfo();
for (int i = 0; i < parent.childrenSize(); i++) {
TreeNode node = parent.getChildren().get(i);
if (node.getValue("open") == null) {
continue;
}
if (node.getValue("open").trim().equals("dbmode")) {
String dbName = node.getValue("dbname");
String serverMode = node.getValue("server_mode");
String error = node.getValue("server_msg");
dbStatus.setDbName(dbName);
if (error != null && !error.equals("none")) {
dbStatus.setErrorInfo(error);
}
dbStatus.setStatusType(DBStatusType.getType(serverMode, serverInfo.isHAMode(dbName)));
dbStatus.setHaHostStatusInfo(currentHaHostStatus);
currentHaHostStatus.addHADatabaseStatus(dbStatus);
} else if (node.getValue("open").trim().equals("dbprocinfo")) {
String dbName = node.getValue("dbname");
String pid = node.getValue("pid");
String state = node.getValue("state");
DbProcessStatusInfo dbProcessStatusInfo = new DbProcessStatusInfo();
dbProcessStatusInfo.setDbName(dbName);
dbProcessStatusInfo.setPid(pid);
dbProcessStatusInfo.setProcessStatus(ProcessStatusType.getType(state));
dbStatus.setDbServerProcessStatus(dbProcessStatusInfo);
} else if (node.getValue("open").trim().equals("applylogdb")) {
buildProcessList(node, dbStatus, "applylogdb");
} else if (node.getValue("open").trim().equals("copylogdb")) {
buildProcessList(node, dbStatus, "copylogdb");
}
}
}
use of com.cubrid.cubridmanager.core.mondashboard.model.DbProcessStatusInfo in project cubrid-manager by CUBRID.
the class HAUtil method getActiveApplyLogDbProcessStatusInfo.
/**
*
* Get the Apply Log DB process status information of active node from
* standby node
*
* @param dbNode DatabaseNode
* @return DbProcessStatusInfo
*/
public static DbProcessStatusInfo getActiveApplyLogDbProcessStatusInfo(DatabaseNode dbNode) {
DbProcessStatusInfo copyLogDbProcessStatusInfo = getActiveCopyLogDbProcessStatusInfo(dbNode);
if (copyLogDbProcessStatusInfo == null) {
return null;
}
String logPath = copyLogDbProcessStatusInfo.getLogPath();
if (logPath == null || logPath.trim().length() == 0) {
return null;
}
HADatabaseStatusInfo dbStatusInfo = dbNode.getHaDatabaseStatus();
List<DbProcessStatusInfo> dbProcessList = dbStatusInfo.getApplyLogDbProcessStatusList();
if (dbProcessList == null || dbProcessList.isEmpty()) {
return null;
}
for (DbProcessStatusInfo processStatusInfo : dbProcessList) {
if (logPath.equals(processStatusInfo.getLogPath())) {
return processStatusInfo;
}
}
return null;
}
Aggregations