ruanwenjun commented on code in PR #16875:
URL:
https://github.com/apache/dolphinscheduler/pull/16875#discussion_r1869646501
##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/cluster/WorkerClusters.java:
##########
@@ -126,6 +138,22 @@ WorkerServerMetadata parseServerFromHeartbeat(String
serverHeartBeatJson) {
@Override
public void onServerAdded(WorkerServerMetadata workerServer) {
workerMapping.put(workerServer.getAddress(), workerServer);
+ synchronized (workerGroupMapping) {
+ List<String> addWorkerGroupAddrList =
workerGroupMapping.get(workerServer.getWorkerGroup());
+ if (addWorkerGroupAddrList == null) {
+ List<String> newWorkerGroupAddrList = new ArrayList<>();
+ newWorkerGroupAddrList.add(workerServer.getAddress());
+ workerGroupMapping.put(workerServer.getWorkerGroup(),
newWorkerGroupAddrList);
+
workerGroupDao.upsertAddrListByWorkerGroupName(workerServer.getWorkerGroup(),
+ String.join(Constants.COMMA, newWorkerGroupAddrList),
+ WorkerGroupSource.CONFIG);
+ } else if
(!addWorkerGroupAddrList.contains(workerServer.getAddress())) {
+ addWorkerGroupAddrList.add(workerServer.getAddress());
+
workerGroupDao.upsertAddrListByWorkerGroupName(workerServer.getWorkerGroup(),
+ String.join(Constants.COMMA, addWorkerGroupAddrList),
+ WorkerGroupSource.CONFIG);
+ }
+ }
Review Comment:
It's not a good idea to add `source` field at worker group, if the worker
group is configured at config, we only need to merge it at memory, we don't
need to persistent it at db, otherwise we need to write a lot of code to make
sure the data in db is correct.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]