Browse Source

[Fix-13283][Master] Worker failover cause task repeat run (#13403)

* [Fix-13283][Master] Worker failover cause task repeat run

* [Fix-13283][Master] Worker failover cause task repeat run
rename variable

* [Fix-13283][Master] Worker failover cause task repeat run
format datetime of log
2.0.8-release
Ken 2 years ago committed by GitHub
parent
commit
11466c934f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java

14
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java

@ -29,6 +29,7 @@ import org.apache.dolphinscheduler.common.enums.StateEvent;
import org.apache.dolphinscheduler.common.enums.StateEventType; import org.apache.dolphinscheduler.common.enums.StateEventType;
import org.apache.dolphinscheduler.common.model.Server; import org.apache.dolphinscheduler.common.model.Server;
import org.apache.dolphinscheduler.common.thread.ThreadUtils; import org.apache.dolphinscheduler.common.thread.ThreadUtils;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.NetUtils; import org.apache.dolphinscheduler.common.utils.NetUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.TaskInstance;
@ -317,11 +318,14 @@ public class MasterRegistryClient {
return false; return false;
} }
Date taskTime = taskInstance.getStartTime() == null ? taskInstance.getSubmitTime() : taskInstance.getStartTime(); Date taskSubmitTime = taskInstance.getSubmitTime();
Date serverStartTime = getServerStartupTime(servers, taskInstance.getHost());
Date serverStartDate = getServerStartupTime(servers, taskInstance.getHost()); if (taskSubmitTime != null && serverStartTime != null && taskSubmitTime.after(serverStartTime)) {
if (serverStartDate != null) { logger.info(
return taskTime.after(serverStartDate); "The taskInstance's submitTime: {} is after the need failover server's start time: {}, the taskInstance is newly submit, it doesn't need to failover",
DateUtils.dateToString(taskSubmitTime),
DateUtils.dateToString(serverStartTime));
return true;
} }
return false; return false;
} }

Loading…
Cancel
Save