This is an automated email from the ASF dual-hosted git repository.
zihaoxiang pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new bc7fbcc799 [Improvement-17304][Master/Worker] Make busy master/worker
can registered (#17305)
bc7fbcc799 is described below
commit bc7fbcc799046faae112eee17bc73183734e2dee
Author: Wenjun Ruan <[email protected]>
AuthorDate: Mon Jul 7 11:01:42 2025 +0800
[Improvement-17304][Master/Worker] Make busy master/worker can registered
(#17305)
---
.../server/master/registry/MasterRegistryClient.java | 12 ------------
.../server/worker/registry/WorkerRegistryClient.java | 16 ++--------------
2 files changed, 2 insertions(+), 26 deletions(-)
diff --git
a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java
b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java
index 626673ab0a..f09fc51683 100644
---
a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java
+++
b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java
@@ -20,8 +20,6 @@ package org.apache.dolphinscheduler.server.master.registry;
import static
org.apache.dolphinscheduler.common.constants.Constants.SLEEP_TIME_MILLIS;
import org.apache.dolphinscheduler.common.IStoppable;
-import org.apache.dolphinscheduler.common.enums.ServerStatus;
-import org.apache.dolphinscheduler.common.model.MasterHeartBeat;
import org.apache.dolphinscheduler.common.thread.ThreadUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.NetUtils;
@@ -94,13 +92,6 @@ public class MasterRegistryClient implements AutoCloseable {
log.info("Master node : {} registering to registry center",
masterConfig.getMasterAddress());
String masterRegistryPath = masterConfig.getMasterRegistryPath();
- MasterHeartBeat heartBeat = masterHeartBeatTask.getHeartBeat();
- while (ServerStatus.BUSY.equals(heartBeat.getServerStatus())) {
- log.warn("Master node is BUSY: {}", heartBeat);
- heartBeat = masterHeartBeatTask.getHeartBeat();
- ThreadUtils.sleep(SLEEP_TIME_MILLIS);
- }
-
// remove before persist
registryClient.remove(masterRegistryPath);
registryClient.persistEphemeral(masterRegistryPath,
JSONUtils.toJsonString(masterHeartBeatTask.getHeartBeat()));
@@ -110,9 +101,6 @@ public class MasterRegistryClient implements AutoCloseable {
ThreadUtils.sleep(SLEEP_TIME_MILLIS);
}
- // sleep 1s, waiting master failover remove
- ThreadUtils.sleep(SLEEP_TIME_MILLIS);
-
masterHeartBeatTask.start();
log.info("Master node : {} registered to registry center
successfully", masterConfig.getMasterAddress());
diff --git
a/dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/registry/WorkerRegistryClient.java
b/dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/registry/WorkerRegistryClient.java
index ca265274b7..225cef6fa7 100644
---
a/dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/registry/WorkerRegistryClient.java
+++
b/dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/registry/WorkerRegistryClient.java
@@ -20,10 +20,7 @@ package org.apache.dolphinscheduler.server.worker.registry;
import static
org.apache.dolphinscheduler.common.constants.Constants.SLEEP_TIME_MILLIS;
import org.apache.dolphinscheduler.common.IStoppable;
-import org.apache.dolphinscheduler.common.constants.Constants;
-import org.apache.dolphinscheduler.common.enums.ServerStatus;
import org.apache.dolphinscheduler.common.model.Server;
-import org.apache.dolphinscheduler.common.model.WorkerHeartBeat;
import org.apache.dolphinscheduler.common.thread.ThreadUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.extract.base.utils.Host;
@@ -84,17 +81,11 @@ public class WorkerRegistryClient implements AutoCloseable {
}
}
- private void registry() throws InterruptedException {
- WorkerHeartBeat workerHeartBeat = workerHeartBeatTask.getHeartBeat();
- while (ServerStatus.BUSY.equals(workerHeartBeat.getServerStatus())) {
- log.warn("Worker node is BUSY: {}", workerHeartBeat);
- workerHeartBeat = workerHeartBeatTask.getHeartBeat();
- Thread.sleep(SLEEP_TIME_MILLIS);
- }
+ private void registry() {
String workerRegistryPath = workerConfig.getWorkerRegistryPath();
// remove before persist
registryClient.remove(workerRegistryPath);
- registryClient.persistEphemeral(workerRegistryPath,
JSONUtils.toJsonString(workerHeartBeat));
+ registryClient.persistEphemeral(workerRegistryPath,
JSONUtils.toJsonString(workerHeartBeatTask.getHeartBeat()));
log.info("Worker node: {} registry to registry center {}
successfully", workerConfig.getWorkerAddress(),
workerRegistryPath);
@@ -102,9 +93,6 @@ public class WorkerRegistryClient implements AutoCloseable {
ThreadUtils.sleep(SLEEP_TIME_MILLIS);
}
- // sleep 1s, waiting master failover remove
- ThreadUtils.sleep(Constants.SLEEP_TIME_MILLIS);
-
workerHeartBeatTask.start();
log.info("Worker node: {} registry finished",
workerConfig.getWorkerAddress());
}