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/06/15 14:32:46 UTC
[GitHub] [iotdb] qiaojialin commented on a diff in pull request #6285: [IOTDB-3182] Judge DataNode status through heartbeat(Simple version)
qiaojialin commented on code in PR #6285:
URL: https://github.com/apache/iotdb/pull/6285#discussion_r898057427
##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/load/heartbeat/HeartbeatWindow.java:
##########
@@ -48,4 +48,10 @@ public void addHeartbeat(HeartbeatPackage newHeartbeat) {
}
}
}
+
Review Comment:
reduce the window size to 100
##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/load/LoadManager.java:
##########
@@ -179,6 +158,51 @@ public void run() {
}
}
+ private THeartbeatReq genHeartbeatReq() {
+ return new THeartbeatReq(System.currentTimeMillis());
+ }
+
+ private void doLoadBalancing(int balanceCount) {
+ if (balanceCount % 5 == 0) {
+ // We update nodes' load statistic in every 5s
+ updateNodeLoadStatistic();
+ }
+ }
+
+ private void updateNodeLoadStatistic() {
+ heartbeatCacheMap.values().forEach(IHeartbeatStatistic::updateLoadStatistic);
+ }
+
+ /**
+ * Send heartbeat requests to all the online DataNodes
+ *
+ * @param onlineDataNodes DataNodes that currently online
+ */
+ private void pingOnlineDataNodes(List<TDataNodeInfo> onlineDataNodes) {
+ // Discard heartbeat cache of the offline DataNodes
+ Set<Integer> onlineIds = new HashSet<>();
+ for (TDataNodeInfo dataNodeInfo : onlineDataNodes) {
+ onlineIds.add(dataNodeInfo.getLocation().getDataNodeId());
+ }
+ for (Integer dataNodeId : heartbeatCacheMap.keySet()) {
+ if (!onlineIds.contains(dataNodeId)) {
+ heartbeatCacheMap.remove(dataNodeId);
+ }
+ }
Review Comment:
The cache could be remove when removing datanode. We do not discard cache here.
##########
confignode/src/main/java/org/apache/iotdb/confignode/manager/load/heartbeat/HeartbeatWindow.java:
##########
@@ -48,4 +48,10 @@ public void addHeartbeat(HeartbeatPackage newHeartbeat) {
}
}
}
+
+ public long getLastSendTime() {
Review Comment:
remove the HeartBeatWindow class, move List<HeartbeatPackage> to HeartbeatCache class
--
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