Browse Source

Merge pull request #365 from qiaozhanwei/branch-1.0.2

master startup fault tolerance update
pull/2/head
乔占卫 6 years ago committed by GitHub
parent
commit
819d41cac2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java
  2. 2
      escheduler-server/src/main/java/cn/escheduler/server/zk/ZKMasterClient.java

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

@ -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){
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
if (getActiveMasterNum() == 1) {
processDao.selfFaultTolerant(ExecutionStatus.RUNNING_EXEUTION.ordinal(),ExecutionStatus.NEED_FAULT_TOLERANCE.ordinal());
processDao.masterStartupFaultTolerant();
}
}catch (Exception e){

Loading…
Cancel
Save