You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/04/01 03:08:00 UTC

[jira] [Work logged] (HDFS-16457) Make fs.getspaceused.classname reconfigurable

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

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

                Author: ASF GitHub Bot
            Created on: 01/Apr/22 03:07
            Start Date: 01/Apr/22 03:07
    Worklog Time Spent: 10m 
      Work Description: singer-bin commented on a change in pull request #4069:
URL: https://github.com/apache/hadoop/pull/4069#discussion_r840195947



##########
File path: hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeReconfiguration.java
##########
@@ -756,4 +759,33 @@ public void testDfsUsageParameters() throws ReconfigurationException {
       }
     }
   }
+
+  public static class DummyCachingGetSpaceUsed extends CachingGetSpaceUsed {
+    public DummyCachingGetSpaceUsed(Builder builder) throws IOException {
+      super(builder.setInterval(1000).setJitter(0L));
+    }
+
+    @Override
+    protected void refresh() {
+      counter++;
+    }
+  }
+
+  @Test
+  public void testDfsUsageKlass() throws IOException, ReconfigurationException,
+          InterruptedException {
+
+    long lastCounter = counter;
+    Thread.sleep(5000);
+    assertTrue(counter > lastCounter);
+
+    for (int i = 0; i < NUM_DATA_NODE; i++) {
+      DataNode dn = cluster.getDataNodes().get(i);
+      dn.reconfigurePropertyImpl(FS_GETSPACEUSED_CLASSNAME, null);
+    }
+
+    lastCounter = counter;
+    Thread.sleep(5000);
+    assertEquals(lastCounter, counter);
+ }

Review comment:
       Hi, thanks for your comment. My UT ideas come from [HDFS-15120](https://issues.apache.org/jira/browse/HDFS-15120) ,you can take a look to help understand. My conf comes from the getNewConf() method as follows:
   
   ``` 
   private void reconfSpaceUsedKlass(){ 
       List<FsVolumeImpl> volumeList = data.getVolumeList(); 
       for (FsVolumeImpl fsVolume : volumeList) { 
         Map<String, BlockPoolSlice> blockPoolSlices = fsVolume.getBlockPoolSlices(); 
         for (BlockPoolSlice bp : blockPoolSlices.values()) { 
           try { 
             bp.refreshSpaceUsedKlass(getNewConf()); 
           } catch (IOException e) { 
             e.printStackTrace(); 
           } 
         } 
       } 
     }
   ```
   
   so , passing in `DummyCachingGetSpaceUsed.class.toString()` in
   
   ``` dn.reconfigurePropertyImpl(FS_GETSPACEUSED_CLASSNAME, DummyCachingGetSpaceUsed.class.toString()); ```
   doesn't make sense to me.
   I need to set it to my own custom class when the service starts, then wait for the counter to change, and then use zzz to refresh the value to the default.
   
   
   




-- 
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-unsubscribe@hadoop.apache.org

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


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

    Worklog Id:     (was: 751360)
    Time Spent: 3h 20m  (was: 3h 10m)

> Make fs.getspaceused.classname reconfigurable
> ---------------------------------------------
>
>                 Key: HDFS-16457
>                 URL: https://issues.apache.org/jira/browse/HDFS-16457
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: namenode
>    Affects Versions: 3.3.0
>            Reporter: yanbin.zhang
>            Assignee: yanbin.zhang
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 3h 20m
>  Remaining Estimate: 0h
>
> Now if we want to switch fs.getspaceused.classname we need to restart the NameNode. It would be convenient if we can switch it at runtime.



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

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