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.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]