This is an automated email from the ASF dual-hosted git repository.

jinyleechina pushed a commit to branch 2.0.8-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/2.0.8-prepare by this push:
     new 11466c934f [Fix-13283][Master] Worker failover cause task repeat run 
(#13403)
11466c934f is described below

commit 11466c934fdd3ad47371b099e0d1db975709ef42
Author: Ken <[email protected]>
AuthorDate: Thu Jan 19 09:46:18 2023 +0800

    [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
---
 .../server/master/registry/MasterRegistryClient.java       | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git 
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java
 
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java
index 906952e709..ed6b29f076 100644
--- 
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java
+++ 
b/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.model.Server;
 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.dao.entity.ProcessInstance;
 import org.apache.dolphinscheduler.dao.entity.TaskInstance;
@@ -317,11 +318,14 @@ public class MasterRegistryClient {
             return false;
         }
 
-        Date taskTime = taskInstance.getStartTime() == null ? 
taskInstance.getSubmitTime() : taskInstance.getStartTime();
-
-        Date serverStartDate = getServerStartupTime(servers, 
taskInstance.getHost());
-        if (serverStartDate != null) {
-            return taskTime.after(serverStartDate);
+        Date taskSubmitTime = taskInstance.getSubmitTime();
+        Date serverStartTime = getServerStartupTime(servers, 
taskInstance.getHost());
+        if (taskSubmitTime != null && serverStartTime != null && 
taskSubmitTime.after(serverStartTime)) {
+            logger.info(
+                    "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;
     }

Reply via email to