tomscut commented on a change in pull request #3827:
URL: https://github.com/apache/hadoop/pull/3827#discussion_r793197883
##########
File path:
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
##########
@@ -642,13 +656,76 @@ public String reconfigurePropertyImpl(String property,
String newVal)
}
break;
}
+ case DFS_DATANODE_PEER_STATS_ENABLED_KEY:
+ case DFS_DATANODE_MIN_OUTLIER_DETECTION_NODES_KEY:
+ case DFS_DATANODE_SLOWPEER_LOW_THRESHOLD_MS_KEY:
+ case DFS_DATANODE_PEER_METRICS_MIN_OUTLIER_DETECTION_SAMPLES_KEY:
+ return reconfSlowPeerParameters(property, newVal);
default:
break;
}
throw new ReconfigurationException(
property, newVal, getConf().get(property));
}
+ private String reconfSlowPeerParameters(String property, String newVal)
+ throws ReconfigurationException {
+ String result;
+ try {
+ LOG.info("Reconfiguring {} to {}", property, newVal);
+ if (property.equals(DFS_DATANODE_PEER_STATS_ENABLED_KEY)) {
+ checkNotNull(dnConf, "DNConf has not been initialized.");
+ if (newVal != null && !newVal.equalsIgnoreCase("true")
+ && !newVal.equalsIgnoreCase("false")) {
+ throw new IllegalArgumentException("Not a valid Boolean value for "
+ property +
+ " in reconfSlowPeerParameters");
+ }
+ boolean enable = (newVal == null ?
DFS_DATANODE_PEER_STATS_ENABLED_DEFAULT :
+ Boolean.parseBoolean(newVal));
+ result = Boolean.toString(enable);
+ dnConf.setPeerStatsEnabled(enable);
+ if (enable) {
+ if (peerMetrics == null) {
+ peerMetrics = DataNodePeerMetrics.create(getDisplayName(),
getConf());
+ }
+ } else {
+ peerMetrics = null;
Review comment:
> `peerMetrics` isn't synchronised and it is being fetched by
BpServiceActor & BlockReciever. I doubt in race conditions this may lead to
some NPE there
Thanks @ayushtkn for your comment.
To avoid NPE, I did not set `peerMetrics` to null when disable, but
`peerMetrics` remains. Do you think such a solution is feasible? Thank you.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]