[ 
https://issues.apache.org/jira/browse/HDFS-16396?focusedWorklogId=704378&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-704378
 ]

ASF GitHub Bot logged work on HDFS-16396:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 06/Jan/22 02:22
            Start Date: 06/Jan/22 02:22
    Worklog Time Spent: 10m 
      Work Description: tomscut commented on a change in pull request #3827:
URL: https://github.com/apache/hadoop/pull/3827#discussion_r779258490



##########
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:
       > Thanks @ayushtkn for your comments.
   > 
   > To avoid NPE, I set `peerStatsEnabled`(volatile) first, and then I add 
judgment `dnConf.peerStatsEnabled && peerMetrics != null` before using 
`peerMetrics`. Do you think this is ok?
   
   Hi @ayushtkn , what do you think of this solution? Thanks.




-- 
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: common-issues-unsubscr...@hadoop.apache.org

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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 704378)
    Time Spent: 2h  (was: 1h 50m)

> Reconfig slow peer parameters for datanode
> ------------------------------------------
>
>                 Key: HDFS-16396
>                 URL: https://issues.apache.org/jira/browse/HDFS-16396
>             Project: Hadoop HDFS
>          Issue Type: New Feature
>            Reporter: tomscut
>            Assignee: tomscut
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> In large clusters, rolling restart datanodes takes a long time. We can make 
> slow peers parameters and slow disks parameters in datanode reconfigurable to 
> facilitate cluster operation and maintenance.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to