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

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

                Author: ASF GitHub Bot
            Created on: 01/Jan/22 18:26
            Start Date: 01/Jan/22 18:26
    Worklog Time Spent: 10m 
      Work Description: ayushtkn commented on a change in pull request #3827:
URL: https://github.com/apache/hadoop/pull/3827#discussion_r777127124



##########
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

##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
##########
@@ -303,7 +312,12 @@
           Arrays.asList(
               DFS_DATANODE_DATA_DIR_KEY,
               DFS_DATANODE_BALANCE_MAX_NUM_CONCURRENT_MOVES_KEY,
-              DFS_BLOCKREPORT_INTERVAL_MSEC_KEY));
+              DFS_BLOCKREPORT_INTERVAL_MSEC_KEY,
+              DFS_BLOCKREPORT_INTERVAL_MSEC_KEY,

Review comment:
       you added it twice

##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
##########
@@ -865,7 +942,7 @@ private void refreshVolumes(String newVolumes) throws 
IOException {
               .newFixedThreadPool(changedVolumes.newLocations.size());
           List<Future<IOException>> exceptions = Lists.newArrayList();
 
-          Preconditions.checkNotNull(data, "Storage not yet initialized");
+          checkNotNull(data, "Storage not yet initialized");

Review comment:
       let the imports stay as is. no need to bother them

##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeReconfiguration.java
##########
@@ -365,4 +372,79 @@ public void testBlockReportIntervalReconfiguration()
           .getConf().get(DFS_BLOCKREPORT_INTERVAL_MSEC_KEY));
     }
   }
+
+  @Test
+  public void testSlowPeerParameters()
+      throws ReconfigurationException {
+    String[] slowPeersParameters = {
+        DFS_DATANODE_MIN_OUTLIER_DETECTION_NODES_KEY,
+        DFS_DATANODE_SLOWPEER_LOW_THRESHOLD_MS_KEY,
+        DFS_DATANODE_PEER_METRICS_MIN_OUTLIER_DETECTION_SAMPLES_KEY};
+
+    for (int i = 0; i < NUM_DATA_NODE; i++) {
+      DataNode dn = cluster.getDataNodes().get(i);
+
+      // Try invalid values.
+      try {
+        dn.reconfigureProperty(DFS_DATANODE_PEER_STATS_ENABLED_KEY, "text");
+      } catch (ReconfigurationException expected) {
+        assertEquals("Could not change property 
dfs.datanode.peer.stats.enabled from 'true' to " +
+            "'text'", expected.getMessage());
+      }

Review comment:
       Use `LambdaTestUtils` instead for such cases




-- 
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]


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

    Worklog Id:     (was: 702749)
    Time Spent: 1h  (was: 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: 1h
>  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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to