advancedxy commented on code in PR #1862:
URL:
https://github.com/apache/incubator-uniffle/pull/1862#discussion_r1666451711
##########
coordinator/src/main/java/org/apache/uniffle/coordinator/ServerNode.java:
##########
@@ -267,4 +277,18 @@ public long getTotalMemory() {
public int getNettyPort() {
return nettyPort;
}
+
+ public void update(ServerNode node) {
+ this.ip = node.getIp();
+ this.grpcPort = node.getGrpcPort();
+ this.usedMemory = node.getUsedMemory();
+ this.preAllocatedMemory = node.getPreAllocatedMemory();
+ this.availableMemory = node.getAvailableMemory();
+ this.eventNumInFlush = node.getEventNumInFlush();
+ this.timestamp = System.currentTimeMillis();
+ this.tags = node.getTags();
+ this.status = node.getStatus();
+ this.storageInfo = node.getStorageInfo();
+ this.nettyPort = node.getNettyPort();
+ }
Review Comment:
I'm not a big fan of mutability too. I don't think we should add this method
if there's other alternatives.
##########
coordinator/src/main/java/org/apache/uniffle/coordinator/SimpleClusterManager.java:
##########
@@ -226,8 +226,11 @@ private void parseExcludeNodesFile(DataInputStream
fsDataInputStream) throws IOE
public void add(ServerNode node) {
if (!servers.containsKey(node.getId())) {
LOG.info("Newly registering node: {}", node.getId());
+ servers.put(node.getId(), node);
+ } else {
+ servers.get(node.getId()).update(node);
Review Comment:
How about this? It should be simpler.
```suggestion
} else {
ServerNode pre = servers.get(node.getId());
long regTime = pre.getRegistrationTime();
// inherit registration time
node.setRegisterationTime(regTime);
```
##########
coordinator/src/main/java/org/apache/uniffle/coordinator/ServerNode.java:
##########
@@ -237,6 +239,14 @@ public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
+ public void setRegistrationTime(long registrationTime) {
Review Comment:
This should be package private.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]