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

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

                Author: ASF GitHub Bot
            Created on: 03/Apr/22 16:11
            Start Date: 03/Apr/22 16:11
    Worklog Time Spent: 10m 
      Work Description: tasanuma commented on a change in pull request #4069:
URL: https://github.com/apache/hadoop/pull/4069#discussion_r839809073



##########
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:
       @singer-bin Thanks for updating the PR.
   How about we stop using `conf.setClass` in `startDFCluster`, and reconfigure 
`DummyCachingGetSpaceUsed` in the unit test, and replace the order of the 
assertions? (But after this change, somehow the unit test failed.)
   ```suggestion
     @Test
     public void testDfsUsageKlass() throws IOException, 
ReconfigurationException,
             InterruptedException {
   
       long lastCounter = counter;
       Thread.sleep(5000);
       assertEquals(lastCounter, counter);
   
       for (int i = 0; i < NUM_DATA_NODE; i++) {
         DataNode dn = cluster.getDataNodes().get(i);
         dn.reconfigurePropertyImpl(FS_GETSPACEUSED_CLASSNAME, 
DummyCachingGetSpaceUsed.class.getName());
       }
   
       lastCounter = counter;
       Thread.sleep(5000);
       assertTrue(counter > lastCounter);
    }
   ```




-- 
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: 752057)
    Time Spent: 4h  (was: 3h 50m)

> 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: 4h
>  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-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to