[
https://issues.apache.org/jira/browse/HDFS-17146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17811887#comment-17811887
]
ASF GitHub Bot commented on HDFS-17146:
---------------------------------------
zhtttylz commented on code in PR #6504:
URL: https://github.com/apache/hadoop/pull/6504#discussion_r1469631441
##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSAdmin.java:
##########
@@ -1283,4 +1285,90 @@ public void testAllDatanodesReconfig()
Assertions.assertThat(outs.subList(1, 5)).containsSubsequence(success,
from, to);
Assertions.assertThat(outs.subList(5, 9)).containsSubsequence(success,
from, to, retrieval);
}
+
+ @Test
+ public void testDecommissionDataNodesReconfig()
+ throws IOException, InterruptedException, TimeoutException {
+ redirectStream();
+
+ ReconfigurationUtil reconfigurationUtil = mock(ReconfigurationUtil.class);
+ cluster.getDataNodes().get(0).setReconfigurationUtil(reconfigurationUtil);
+ cluster.getDataNodes().get(1).setReconfigurationUtil(reconfigurationUtil);
+ List<ReconfigurationUtil.PropertyChange> changes = new ArrayList<>();
+ changes.add(new ReconfigurationUtil.PropertyChange(
+ DFS_DATANODE_DATA_TRANSFER_BANDWIDTHPERSEC_KEY
+ , "1000",
+
datanode.getConf().get(DFS_DATANODE_DATA_TRANSFER_BANDWIDTHPERSEC_KEY)));
+ when(reconfigurationUtil.parseChangedProperties(any(Configuration.class),
+ any(Configuration.class))).thenReturn(changes);
+
+ DFSAdmin dfsAdmin = Mockito.spy(new DFSAdmin(conf));
+ DistributedFileSystem dfs = Mockito.spy(cluster.getFileSystem());
+ DatanodeInfo decommissionNode = dfs.getDataNodeStats()[0];
+ DatanodeInfo[] dataNodeStats = new DatanodeInfo[]{decommissionNode};
+ when(dfsAdmin.getDFS()).thenReturn(dfs);
+
when(dfs.getDataNodeStats(DatanodeReportType.DECOMMISSIONING)).thenReturn(dataNodeStats);
+
+ int ret = dfsAdmin.startReconfiguration("datanode", "decomnodes");
+
+ // collect outputs
+ final List<String> outsForStartReconf = Lists.newArrayList();
+ final List<String> errsForStartReconf = Lists.newArrayList();
+ scanIntoList(out, outsForStartReconf);
+ scanIntoList(err, errsForStartReconf);
+
+ // verify startReconfiguration results is as expected
+ assertEquals(0, ret);
+ String started = "Started reconfiguration task on node";
+ String starting =
+ "Starting of reconfiguration task successful on 1 nodes, failed on 0
nodes.";
Review Comment:
Thanks for the guidance! I will expedite the code revisions accordingly.
> Use the dfsadmin -reconfig command to initiate reconfiguration on all
> decommissioning datanodes.
> ------------------------------------------------------------------------------------------------
>
> Key: HDFS-17146
> URL: https://issues.apache.org/jira/browse/HDFS-17146
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: hdfs
> Affects Versions: 3.4.0
> Reporter: Hualong Zhang
> Assignee: Hualong Zhang
> Priority: Major
> Labels: pull-request-available
>
> If the *DFSAdmin* command could have the ability to perform bulk operations
> across all decommissioned datanodes, that would be highly advantageous.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]