[
https://issues.apache.org/jira/browse/HDFS-16624?focusedWorklogId=779265&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-779265
]
ASF GitHub Bot logged work on HDFS-16624:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 07/Jun/22 22:04
Start Date: 07/Jun/22 22:04
Worklog Time Spent: 10m
Work Description: virajjasani commented on code in PR #4412:
URL: https://github.com/apache/hadoop/pull/4412#discussion_r891747569
##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDFSAdmin.java:
##########
@@ -1205,9 +1205,9 @@ public void testAllDatanodesReconfig()
LOG.info("dfsadmin -status -livenodes output:");
outs.forEach(s -> LOG.info("{}", s));
assertTrue(outs.get(0).startsWith("Reconfiguring status for node"));
- assertEquals("SUCCESS: Changed property dfs.datanode.peer.stats.enabled",
outs.get(2));
- assertEquals("\tFrom: \"false\"", outs.get(3));
- assertEquals("\tTo: \"true\"", outs.get(4));
+ assertEquals("SUCCESS: Changed property dfs.datanode.peer.stats.enabled",
outs.get(1));
+ assertEquals("\tFrom: \"false\"", outs.get(2));
+ assertEquals("\tTo: \"true\"", outs.get(3));
Review Comment:
Given that concurrency is at play here, we can do something like this:
```
assertTrue("SUCCESS: Changed property
dfs.datanode.peer.stats.enabled".equals(outs.get(2))
|| "SUCCESS: Changed property
dfs.datanode.peer.stats.enabled".equals(outs.get(1)));
```
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java:
##########
@@ -2068,51 +2068,51 @@ int getReconfigurationStatus(final String nodeType,
final String address, final
errMsg = String.format("Node [%s] reloading configuration: %s.", address,
e.toString());
}
-
- if (errMsg != null) {
- err.println(errMsg);
- return 1;
- } else {
- out.print(outMsg);
- }
-
- if (status != null) {
- if (!status.hasTask()) {
- out.println("no task was found.");
- return 0;
- }
- out.print("started at " + new Date(status.getStartTime()));
- if (!status.stopped()) {
- out.println(" and is still running.");
- return 0;
+ synchronized (this) {
Review Comment:
@slfan1989 This is good for concurrency control but we should avoid this for
performance issues. Rather, we can update test.
Issue Time Tracking
-------------------
Worklog Id: (was: 779265)
Time Spent: 1.5h (was: 1h 20m)
> Fix org.apache.hadoop.hdfs.tools.TestDFSAdmin#testAllDatanodesReconfig ERROR
> ----------------------------------------------------------------------------
>
> Key: HDFS-16624
> URL: https://issues.apache.org/jira/browse/HDFS-16624
> Project: Hadoop HDFS
> Issue Type: Bug
> Affects Versions: 3.4.0
> Reporter: fanshilun
> Assignee: fanshilun
> Priority: Major
> Labels: pull-request-available
> Attachments: testAllDatanodesReconfig.png
>
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> HDFS-16619 found an error message during Junit unit testing, as follows:
> expected:<[SUCCESS: Changed property dfs.datanode.peer.stats.enabled]> but
> was:<[ From: "false"]>
> After code debugging, it was found that there was an error in the selection
> outs.get(2) of the assertion(1208), index should be equal to 1.
> Please refer to the attachment for debugging pictures
> !testAllDatanodesReconfig.png!
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]