You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/08/25 02:52:46 UTC

[GitHub] [iotdb] CRZbulabula commented on a diff in pull request #7108: [IOTDB-4206] Record DataNode's read-only status in ConfigNode

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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org