Skip to content

Commit bc7fbcc

Browse files
authored
[Improvement-17304][Master/Worker] Make busy master/worker can registered (#17305)
1 parent bcf89fe commit bc7fbcc

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
import static org.apache.dolphinscheduler.common.constants.Constants.SLEEP_TIME_MILLIS;
2121

2222
import org.apache.dolphinscheduler.common.IStoppable;
23-
import org.apache.dolphinscheduler.common.enums.ServerStatus;
24-
import org.apache.dolphinscheduler.common.model.MasterHeartBeat;
2523
import org.apache.dolphinscheduler.common.thread.ThreadUtils;
2624
import org.apache.dolphinscheduler.common.utils.JSONUtils;
2725
import org.apache.dolphinscheduler.common.utils.NetUtils;
@@ -94,13 +92,6 @@ void registry() {
9492
log.info("Master node : {} registering to registry center", masterConfig.getMasterAddress());
9593
String masterRegistryPath = masterConfig.getMasterRegistryPath();
9694

97-
MasterHeartBeat heartBeat = masterHeartBeatTask.getHeartBeat();
98-
while (ServerStatus.BUSY.equals(heartBeat.getServerStatus())) {
99-
log.warn("Master node is BUSY: {}", heartBeat);
100-
heartBeat = masterHeartBeatTask.getHeartBeat();
101-
ThreadUtils.sleep(SLEEP_TIME_MILLIS);
102-
}
103-
10495
// remove before persist
10596
registryClient.remove(masterRegistryPath);
10697
registryClient.persistEphemeral(masterRegistryPath, JSONUtils.toJsonString(masterHeartBeatTask.getHeartBeat()));
@@ -110,9 +101,6 @@ void registry() {
110101
ThreadUtils.sleep(SLEEP_TIME_MILLIS);
111102
}
112103

113-
// sleep 1s, waiting master failover remove
114-
ThreadUtils.sleep(SLEEP_TIME_MILLIS);
115-
116104
masterHeartBeatTask.start();
117105
log.info("Master node : {} registered to registry center successfully", masterConfig.getMasterAddress());
118106

dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/registry/WorkerRegistryClient.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020
import static org.apache.dolphinscheduler.common.constants.Constants.SLEEP_TIME_MILLIS;
2121

2222
import org.apache.dolphinscheduler.common.IStoppable;
23-
import org.apache.dolphinscheduler.common.constants.Constants;
24-
import org.apache.dolphinscheduler.common.enums.ServerStatus;
2523
import org.apache.dolphinscheduler.common.model.Server;
26-
import org.apache.dolphinscheduler.common.model.WorkerHeartBeat;
2724
import org.apache.dolphinscheduler.common.thread.ThreadUtils;
2825
import org.apache.dolphinscheduler.common.utils.JSONUtils;
2926
import org.apache.dolphinscheduler.extract.base.utils.Host;
@@ -84,27 +81,18 @@ public void start() {
8481
}
8582
}
8683

87-
private void registry() throws InterruptedException {
88-
WorkerHeartBeat workerHeartBeat = workerHeartBeatTask.getHeartBeat();
89-
while (ServerStatus.BUSY.equals(workerHeartBeat.getServerStatus())) {
90-
log.warn("Worker node is BUSY: {}", workerHeartBeat);
91-
workerHeartBeat = workerHeartBeatTask.getHeartBeat();
92-
Thread.sleep(SLEEP_TIME_MILLIS);
93-
}
84+
private void registry() {
9485
String workerRegistryPath = workerConfig.getWorkerRegistryPath();
9586
// remove before persist
9687
registryClient.remove(workerRegistryPath);
97-
registryClient.persistEphemeral(workerRegistryPath, JSONUtils.toJsonString(workerHeartBeat));
88+
registryClient.persistEphemeral(workerRegistryPath, JSONUtils.toJsonString(workerHeartBeatTask.getHeartBeat()));
9889
log.info("Worker node: {} registry to registry center {} successfully", workerConfig.getWorkerAddress(),
9990
workerRegistryPath);
10091

10192
while (!registryClient.checkNodeExists(workerConfig.getWorkerAddress(), RegistryNodeType.WORKER)) {
10293
ThreadUtils.sleep(SLEEP_TIME_MILLIS);
10394
}
10495

105-
// sleep 1s, waiting master failover remove
106-
ThreadUtils.sleep(Constants.SLEEP_TIME_MILLIS);
107-
10896
workerHeartBeatTask.start();
10997
log.info("Worker node: {} registry finished", workerConfig.getWorkerAddress());
11098
}

0 commit comments

Comments
 (0)