Caideyipi commented on code in PR #18381:
URL: https://github.com/apache/iotdb/pull/18381#discussion_r3734760817
##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/task/meta/PipeTemporaryMetaInCoordinator.java:
##########
@@ -58,6 +65,27 @@ public void setDegraded(final int dataNodeId, final Boolean
isDegraded) {
}
}
+ public void setRecentFailures(final int dataNodeId, final Map<String, Long>
recentFailures) {
+ if (Objects.isNull(recentFailures) || recentFailures.isEmpty()) {
+ nodeId2RecentFailuresMap.remove(dataNodeId);
+ return;
+ }
+
+ final Map<String, Long> sanitizedFailures = new HashMap<>();
+ recentFailures.forEach(
+ (failureType, count) -> {
+ if (Objects.nonNull(failureType) && Objects.nonNull(count) && count
> 0) {
+ sanitizedFailures.put(failureType, count);
+ }
+ });
Review Comment:
The sanitization is defensive: heartbeat payloads are remote input, and
null, non-positive, or null-key entries must not enter the coordinator
aggregate or produce negative counts. It also lets an invalid-only update clear
the node snapshot consistently with an empty update. The extra map is therefore
intentional.
--
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]