This is an automated email from the ASF dual-hosted git repository.
rickyma pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git
The following commit(s) were added to refs/heads/master by this push:
new b97dbcead [#1471] feat(server/dashboard): Add Reg time to ServerNode
(#1862)
b97dbcead is described below
commit b97dbcead3d764dfcae970f412b3b73f9b26667b
Author: maobaolong <[email protected]>
AuthorDate: Tue Jul 9 15:38:41 2024 +0800
[#1471] feat(server/dashboard): Add Reg time to ServerNode (#1862)
### What changes were proposed in this pull request?
Add reg time to ServerNode, and update method to update ServerNode when
server heartbeat to coordinator rather than replace serverNode object.
### Why are the changes needed?
Fix: #1471
### Does this PR introduce _any_ user-facing change?
User can get registrationTime from dashboard server page.
### How was this patch tested?
<img width="2462" alt="image"
src="https://github.com/apache/incubator-uniffle/assets/17329931/423733c7-7bb8-44f1-8f02-d8f6ef5026a5">
<img width="2478" alt="image"
src="https://github.com/apache/incubator-uniffle/assets/17329931/aedd73c5-77f4-4264-8ae7-e43cc89c04cc">
---
.../java/org/apache/uniffle/coordinator/ClusterManager.java | 2 +-
.../main/java/org/apache/uniffle/coordinator/ServerNode.java | 12 +++++++++++-
.../org/apache/uniffle/coordinator/SimpleClusterManager.java | 8 +++++++-
.../webapp/src/pages/serverstatus/ActiveNodeListPage.vue | 7 +++++++
.../src/pages/serverstatus/DecommissionednodeListPage.vue | 7 +++++++
.../src/pages/serverstatus/DecommissioningNodeListPage.vue | 7 +++++++
.../src/main/webapp/src/pages/serverstatus/LostNodeList.vue | 7 +++++++
.../webapp/src/pages/serverstatus/UnhealthyNodeListPage.vue | 7 +++++++
8 files changed, 54 insertions(+), 3 deletions(-)
diff --git
a/coordinator/src/main/java/org/apache/uniffle/coordinator/ClusterManager.java
b/coordinator/src/main/java/org/apache/uniffle/coordinator/ClusterManager.java
index 1b44eea02..0ef8b8bda 100644
---
a/coordinator/src/main/java/org/apache/uniffle/coordinator/ClusterManager.java
+++
b/coordinator/src/main/java/org/apache/uniffle/coordinator/ClusterManager.java
@@ -24,7 +24,7 @@ import java.util.Set;
public interface ClusterManager extends Closeable {
/**
- * Add a server to the cluster.
+ * Add or update a server to the cluster.
*
* @param shuffleServerInfo server info
*/
diff --git
a/coordinator/src/main/java/org/apache/uniffle/coordinator/ServerNode.java
b/coordinator/src/main/java/org/apache/uniffle/coordinator/ServerNode.java
index 93b1e59c3..ec33d262a 100644
--- a/coordinator/src/main/java/org/apache/uniffle/coordinator/ServerNode.java
+++ b/coordinator/src/main/java/org/apache/uniffle/coordinator/ServerNode.java
@@ -36,6 +36,7 @@ public class ServerNode implements Comparable<ServerNode> {
private long preAllocatedMemory;
private long availableMemory;
private int eventNumInFlush;
+ private long registrationTime;
private long timestamp;
private Set<String> tags;
private ServerStatus status;
@@ -136,7 +137,8 @@ public class ServerNode implements Comparable<ServerNode> {
this.preAllocatedMemory = preAllocatedMemory;
this.availableMemory = availableMemory;
this.eventNumInFlush = eventNumInFlush;
- this.timestamp = System.currentTimeMillis();
+ this.registrationTime = System.currentTimeMillis();
+ this.timestamp = registrationTime;
this.tags = tags;
this.status = status;
this.storageInfo = storageInfoMap;
@@ -237,6 +239,14 @@ public class ServerNode implements Comparable<ServerNode> {
this.timestamp = timestamp;
}
+ void setRegistrationTime(long registrationTime) {
+ this.registrationTime = registrationTime;
+ }
+
+ public long getRegistrationTime() {
+ return registrationTime;
+ }
+
@Override
public int compareTo(ServerNode other) {
if (availableMemory > other.getAvailableMemory()) {
diff --git
a/coordinator/src/main/java/org/apache/uniffle/coordinator/SimpleClusterManager.java
b/coordinator/src/main/java/org/apache/uniffle/coordinator/SimpleClusterManager.java
index 28a9a1189..e5f7ec3a7 100644
---
a/coordinator/src/main/java/org/apache/uniffle/coordinator/SimpleClusterManager.java
+++
b/coordinator/src/main/java/org/apache/uniffle/coordinator/SimpleClusterManager.java
@@ -224,10 +224,16 @@ public class SimpleClusterManager implements
ClusterManager {
@Override
public void add(ServerNode node) {
- if (!servers.containsKey(node.getId())) {
+ ServerNode pre = servers.get(node.getId());
+ if (pre == null) {
LOG.info("Newly registering node: {}", node.getId());
+ } else {
+ long regTime = pre.getRegistrationTime();
+ // inherit registration time
+ node.setRegistrationTime(regTime);
}
servers.put(node.getId(), node);
+
Set<String> tags = node.getTags();
// remove node with all tags to deal with the situation of tag change
for (Set<ServerNode> nodes : tagToNodes.values()) {
diff --git
a/dashboard/src/main/webapp/src/pages/serverstatus/ActiveNodeListPage.vue
b/dashboard/src/main/webapp/src/pages/serverstatus/ActiveNodeListPage.vue
index 659a3feb9..8b08c13d2 100644
--- a/dashboard/src/main/webapp/src/pages/serverstatus/ActiveNodeListPage.vue
+++ b/dashboard/src/main/webapp/src/pages/serverstatus/ActiveNodeListPage.vue
@@ -37,6 +37,12 @@
/>
<el-table-column prop="eventNumInFlush" label="FlushNum" min-width="80"
/>
<el-table-column prop="status" label="Status" min-width="80" />
+ <el-table-column
+ prop="registrationTime"
+ label="RegistrationTime"
+ min-width="80"
+ :formatter="dateFormatter"
+ />
<el-table-column
prop="timestamp"
label="HeartbeatTime"
@@ -68,6 +74,7 @@ export default {
eventNumInFlush: 0,
tags: '',
status: '',
+ registrationTime: '',
timestamp: ''
}
]
diff --git
a/dashboard/src/main/webapp/src/pages/serverstatus/DecommissionednodeListPage.vue
b/dashboard/src/main/webapp/src/pages/serverstatus/DecommissionednodeListPage.vue
index 9e9f5f11b..dae4a6c18 100644
---
a/dashboard/src/main/webapp/src/pages/serverstatus/DecommissionednodeListPage.vue
+++
b/dashboard/src/main/webapp/src/pages/serverstatus/DecommissionednodeListPage.vue
@@ -37,6 +37,12 @@
/>
<el-table-column prop="eventNumInFlush" label="FlushNum" min-width="80"
/>
<el-table-column prop="status" label="Status" min-width="80" />
+ <el-table-column
+ prop="registrationTime"
+ label="RegistrationTime"
+ min-width="80"
+ :formatter="dateFormatter"
+ />
<el-table-column
prop="timestamp"
label="HeartbeatTime"
@@ -68,6 +74,7 @@ export default {
eventNumInFlush: 0,
tags: '',
status: '',
+ registrationTime: '',
timestamp: ''
}
]
diff --git
a/dashboard/src/main/webapp/src/pages/serverstatus/DecommissioningNodeListPage.vue
b/dashboard/src/main/webapp/src/pages/serverstatus/DecommissioningNodeListPage.vue
index 7633f5a77..58e52aa6f 100644
---
a/dashboard/src/main/webapp/src/pages/serverstatus/DecommissioningNodeListPage.vue
+++
b/dashboard/src/main/webapp/src/pages/serverstatus/DecommissioningNodeListPage.vue
@@ -37,6 +37,12 @@
/>
<el-table-column prop="eventNumInFlush" label="FlushNum" min-width="80"
/>
<el-table-column prop="status" label="Status" min-width="80" />
+ <el-table-column
+ prop="registrationTime"
+ label="RegistrationTime"
+ min-width="80"
+ :formatter="dateFormatter"
+ />
<el-table-column
prop="timestamp"
label="HeartbeatTime"
@@ -68,6 +74,7 @@ export default {
eventNumInFlush: 0,
tags: '',
status: '',
+ registrationTime: '',
timestamp: ''
}
]
diff --git a/dashboard/src/main/webapp/src/pages/serverstatus/LostNodeList.vue
b/dashboard/src/main/webapp/src/pages/serverstatus/LostNodeList.vue
index f46d03f8e..2bb8de2f7 100644
--- a/dashboard/src/main/webapp/src/pages/serverstatus/LostNodeList.vue
+++ b/dashboard/src/main/webapp/src/pages/serverstatus/LostNodeList.vue
@@ -37,6 +37,12 @@
/>
<el-table-column prop="eventNumInFlush" label="FlushNum" min-width="80"
/>
<el-table-column prop="status" label="Status" min-width="80" />
+ <el-table-column
+ prop="registrationTime"
+ label="RegistrationTime"
+ min-width="80"
+ :formatter="dateFormatter"
+ />
<el-table-column
prop="timestamp"
label="HeartbeatTime"
@@ -68,6 +74,7 @@ export default {
eventNumInFlush: 0,
tags: '',
status: '',
+ registrationTime: '',
timestamp: ''
}
]
diff --git
a/dashboard/src/main/webapp/src/pages/serverstatus/UnhealthyNodeListPage.vue
b/dashboard/src/main/webapp/src/pages/serverstatus/UnhealthyNodeListPage.vue
index 4472106c8..6073b994d 100644
--- a/dashboard/src/main/webapp/src/pages/serverstatus/UnhealthyNodeListPage.vue
+++ b/dashboard/src/main/webapp/src/pages/serverstatus/UnhealthyNodeListPage.vue
@@ -37,6 +37,12 @@
/>
<el-table-column prop="eventNumInFlush" label="FlushNum" min-width="80"
/>
<el-table-column prop="status" label="Status" min-width="80" />
+ <el-table-column
+ prop="registrationTime"
+ label="RegistrationTime"
+ min-width="80"
+ :formatter="dateFormatter"
+ />
<el-table-column
prop="timestamp"
label="HeartbeatTime"
@@ -68,6 +74,7 @@ export default {
eventNumInFlush: 0,
tags: '',
status: '',
+ registrationTime: '',
timestamp: ''
}
]