CRZbulabula commented on code in PR #7108:
URL: https://github.com/apache/iotdb/pull/7108#discussion_r954453824


##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/load/heartbeat/DataNodeHeartbeatCache.java:
##########
@@ -112,12 +95,6 @@ public NodeStatus getNodeStatus() {
     }
 
     // Return a copy of status
-    switch (status) {
-      case Running:
-        return NodeStatus.Running;
-      case Unknown:
-      default:
-        return NodeStatus.Unknown;
-    }
+    return NodeStatus.valueOf(status.getStatus());

Review Comment:
   Fixed~



##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/load/heartbeat/DataNodeHeartbeatCache.java:
##########
@@ -94,15 +84,8 @@ public long getLoadScore() {
       return Long.MAX_VALUE;
     }
 
-    // Return a copy of loadScore
-    switch (status) {
-      case Running:
-        return loadScore;
-      case Unknown:
-      default:
-        // The Unknown Node will get the highest loadScore
-        return Long.MAX_VALUE;
-    }
+    // The DataNode whose status isn't Running will get the highest loadScore
+    return status == NodeStatus.Running ? loadScore : Long.MAX_VALUE;

Review Comment:
   Fixed~



##########
server/src/main/java/org/apache/iotdb/db/service/thrift/impl/DataNodeInternalRPCServiceImpl.java:
##########
@@ -384,6 +384,7 @@ public TSStatus invalidateSchemaCache(TInvalidateCacheReq 
req) {
   public THeartbeatResp getDataNodeHeartBeat(THeartbeatReq req) throws 
TException {
     THeartbeatResp resp = new THeartbeatResp();
     resp.setHeartbeatTimestamp(req.getHeartbeatTimestamp());
+    
resp.setStatus(IoTDBDescriptor.getInstance().getConfig().getSystemStatus().getStatus());

Review Comment:
   Fixed~



-- 
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]

Reply via email to