diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskCallbackService.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskCallbackService.java index 1e8bf9d0e7..173140792b 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskCallbackService.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskCallbackService.java @@ -95,14 +95,18 @@ public class TaskCallbackService { if(newChannel != null){ return getRemoteChannel(newChannel, nettyRemoteChannel.getOpaque(), taskInstanceId); } - logger.warn("original master : {} is not reachable, random select master", nettyRemoteChannel.getHost()); + logger.warn("original master : {} for task : {} is not reachable, random select master", + nettyRemoteChannel.getHost(), + taskInstanceId); Set masterNodes = null; while (Stopper.isRunning()) { masterNodes = zookeeperRegistryCenter.getMasterNodesDirectly(); if (CollectionUtils.isEmpty(masterNodes)) { - logger.error("no available master node"); ThreadUtils.sleep(SLEEP_TIME_MILLIS); }else { + logger.error("find {} masters for task : {}.", + masterNodes.size(), + taskInstanceId); break; } } @@ -112,7 +116,7 @@ public class TaskCallbackService { return getRemoteChannel(newChannel, nettyRemoteChannel.getOpaque(), taskInstanceId); } } - throw new IllegalStateException(String.format("all available master nodes : %s are not reachable", masterNodes)); + throw new IllegalStateException(String.format("all available master nodes : %s are not reachable for task: {}", masterNodes, taskInstanceId)); } private NettyRemoteChannel getRemoteChannel(Channel newChannel, long opaque, int taskInstanceId){ diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java index 1b807a7278..686d73d8ac 100644 --- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java +++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/zk/ZKMasterClient.java @@ -262,7 +262,7 @@ public class ZKMasterClient extends AbstractZKClient { Date workerServerStartDate = null; List workerServers = getServersList(ZKNodeType.WORKER); for(Server workerServer : workerServers){ - if(workerServer.getHost().equals(taskInstance.getHost())){ + if(taskInstance.getHost().equals(workerServer.getHost() + Constants.COLON + workerServer.getPort())){ workerServerStartDate = workerServer.getCreateTime(); break; } diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java index 2960969d86..1cc4db6fea 100644 --- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java +++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/zk/AbstractZKClient.java @@ -187,7 +187,7 @@ public abstract class AbstractZKClient extends ZookeeperCachedOperator { } Map serverMaps = getServerMaps(zkNodeType); for(String hostKey : serverMaps.keySet()){ - if(hostKey.startsWith(host)){ + if(hostKey.contains(host)){ return true; } }