Browse Source

master startup fault tolerance update

pull/2/head
qiaozhanwei 6 years ago
parent
commit
7e22b6a520
  1. 14
      escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java
  2. 2
      escheduler-server/src/main/java/cn/escheduler/server/zk/ZKMasterClient.java

14
escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java

@ -1377,7 +1377,7 @@ public class ProcessDao extends AbstractBaseDao {
* @return * @return
*/ */
public List<TaskInstance> queryNeedFailoverTaskInstances(String host){ public List<TaskInstance> queryNeedFailoverTaskInstances(String host){
return taskInstanceMapper.queryByHostAndStatus(host,stateArray); return taskInstanceMapper.queryByHostAndStatus(host, stateArray);
} }
/** /**
@ -1555,10 +1555,16 @@ public class ProcessDao extends AbstractBaseDao {
} }
public void selfFaultTolerant(int ... states){ /**
List<ProcessInstance> processInstanceList = processInstanceMapper.listByStatus(states); * master starup fault tolerant
*/
public void masterStartupFaultTolerant(){
int[] readyStopAndKill=new int[]{ExecutionStatus.READY_PAUSE.ordinal(),ExecutionStatus.READY_STOP.ordinal(),
ExecutionStatus.NEED_FAULT_TOLERANCE.ordinal(),ExecutionStatus.RUNNING_EXEUTION.ordinal()};
List<ProcessInstance> processInstanceList = processInstanceMapper.listByStatus(readyStopAndKill);
for (ProcessInstance processInstance:processInstanceList){ for (ProcessInstance processInstance:processInstanceList){
selfFaultTolerant(processInstance); processNeedFailoverProcessInstances(processInstance);
} }
} }

2
escheduler-server/src/main/java/cn/escheduler/server/zk/ZKMasterClient.java

@ -134,7 +134,7 @@ public class ZKMasterClient extends AbstractZKClient {
// check if fault tolerance is required,failure and tolerance // check if fault tolerance is required,failure and tolerance
if (getActiveMasterNum() == 1) { if (getActiveMasterNum() == 1) {
processDao.selfFaultTolerant(ExecutionStatus.RUNNING_EXEUTION.ordinal(),ExecutionStatus.NEED_FAULT_TOLERANCE.ordinal()); processDao.masterStartupFaultTolerant();
} }
}catch (Exception e){ }catch (Exception e){

Loading…
Cancel
Save