[ 
https://issues.apache.org/jira/browse/HDFS-17858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18041803#comment-18041803
 ] 

ASF GitHub Bot commented on HDFS-17858:
---------------------------------------

lfxy commented on code in PR #8107:
URL: https://github.com/apache/hadoop/pull/8107#discussion_r2576598141


##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSAdmin.java:
##########
@@ -1249,8 +1249,15 @@ public void testAllDatanodesReconfig()
     when(reconfigurationUtil.parseChangedProperties(any(Configuration.class),
         any(Configuration.class))).thenReturn(changes);
 
-    int result = admin.startReconfiguration("datanode", "livenodes");
-    assertThat(result).isEqualTo(0);
+    LambdaTestUtils.await(1000, 50, () -> {
+      int result = admin.startReconfiguration("datanode", "livenodes");
+      assertThat(result).isEqualTo(0);
+      final List<String> outs = new ArrayList<>();
+      final List<String> errs = new ArrayList<>();
+      awaitReconfigurationFinished("datanode", "livenodes", outs, errs);
+      return errs.isEmpty();
+    });
+

Review Comment:
   We cannot determine whether the reconfiguration has finished based on the 
return value of admin.startReconfiguration(), because even if it returns 0, the 
datanode's reconfig thread may not have finished. We need to actively get the 
reconfiguration status using getReconfigurationStatus, to wait reconfiguration 
finished.





> Fix TestDFSAdmin#testAllDatanodesReconfig fails
> -----------------------------------------------
>
>                 Key: HDFS-17858
>                 URL: https://issues.apache.org/jira/browse/HDFS-17858
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: test
>    Affects Versions: 3.5.0
>            Reporter: caozhiqiang
>            Assignee: caozhiqiang
>            Priority: Major
>              Labels: pull-request-available
>
> TestDFSAdmin::testAllDatanodesReconfig() always failed because the last 
> startReconfiguration() need some time to finish.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to