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

Xiao Liang commented on HDFS-13681:
-----------------------------------

There are 2 issues causing TestStartup.testNNFailToStartOnReadOnlyNNDir fail on 
Windows:
 # Path comparison, that the Path class does not work perfectly on Windows, 
from the error message we can see the 2 paths are logically identical, but the 
string literals are not;
 # Improper file permission API, according to the description of 
*org.apache.hadoop.fs.FileUtil#setWritable*, *File#setWritable* does not work 
as expected on Windows, so should use *FileUtil#setWritable* instead.

Without the patch, test result of this case in my local Windows machine is:

{color:#d04437}[INFO] 
-------------------------------------------------------{color}
{color:#d04437}[INFO] T E S T S{color}
{color:#d04437}[INFO] 
-------------------------------------------------------{color}
{color:#d04437}[INFO] Running 
org.apache.hadoop.hdfs.server.namenode.TestStartup{color}
{color:#d04437}[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time 
elapsed: 4.269 s <<< FAILURE! - in 
org.apache.hadoop.hdfs.server.namenode.TestStartup{color}
{color:#d04437}[ERROR] 
testNNFailToStartOnReadOnlyNNDir(org.apache.hadoop.hdfs.server.namenode.TestStartup)
 Time elapsed: 4.119 s <<< FAILURE!{color}
{color:#d04437}org.junit.ComparisonFailure: NN dir should be created after NN 
startup. 
expected:<[D:\Git\Hadoop\hadoop-hdfs-project\hadoop-hdfs\target\test\data\dfs\testNNFailToStartOnReadOnlyNNDir\]name>
 but 
was:<[/D:/Git/Hadoop/hadoop-hdfs-project/hadoop-hdfs/target/test/data/dfs/testNNFailToStartOnReadOnlyNNDir/]name>{color}
{color:#d04437} at org.junit.Assert.assertEquals(Assert.java:115){color}
{color:#d04437} at 
org.apache.hadoop.hdfs.server.namenode.TestStartup.testNNFailToStartOnReadOnlyNNDir(TestStartup.java:729){color}
{color:#d04437} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method){color}
{color:#d04437} at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62){color}
{color:#d04437} at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43){color}
{color:#d04437} at java.lang.reflect.Method.invoke(Method.java:498){color}
{color:#d04437} at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47){color}
{color:#d04437} at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12){color}
{color:#d04437} at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44){color}
{color:#d04437} at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17){color}
{color:#d04437} at 
org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74){color}

{color:#d04437}[INFO]{color}
{color:#d04437}[INFO] Results:{color}
{color:#d04437}[INFO]{color}
{color:#d04437}[ERROR] Failures:{color}
{color:#d04437}[ERROR] TestStartup.testNNFailToStartOnReadOnlyNNDir:729 NN dir 
should be created after NN startup. 
expected:<[D:\Git\Hadoop\hadoop-hdfs-project\hadoop-hdfs\target\test\data\dfs\testNNFailToStartOnReadOnlyNNDir\]name>
 but 
was:<[/D:/Git/Hadoop/hadoop-hdfs-project/hadoop-hdfs/target/test/data/dfs/testNNFailToStartOnReadOnlyNNDir/]name>{color}

With the patch, the result on Windows is:

{color:#14892c}[INFO] 
-------------------------------------------------------{color}
{color:#14892c}[INFO] T E S T S{color}
{color:#14892c}[INFO] 
-------------------------------------------------------{color}
{color:#14892c}[INFO] Running 
org.apache.hadoop.hdfs.server.namenode.TestStartup{color}
{color:#14892c}[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time 
elapsed: 4.481 s - in org.apache.hadoop.hdfs.server.namenode.TestStartup{color}
{color:#14892c}[INFO]{color}
{color:#14892c}[INFO] Results:{color}
{color:#14892c}[INFO]{color}
{color:#14892c}[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0{color}

The patch [^HDFS-13681.000.patch] can also be applied to branch-2.

> Fix TestStartup.testNNFailToStartOnReadOnlyNNDir test failure on Windows
> ------------------------------------------------------------------------
>
>                 Key: HDFS-13681
>                 URL: https://issues.apache.org/jira/browse/HDFS-13681
>             Project: Hadoop HDFS
>          Issue Type: Test
>          Components: test
>    Affects Versions: 3.1.0, 2.9.1
>            Reporter: Xiao Liang
>            Assignee: Xiao Liang
>            Priority: Major
>              Labels: windows
>         Attachments: HDFS-13681.000.patch
>
>
> org.apache.hadoop.hdfs.server.namenode.TestStartup.testNNFailToStartOnReadOnlyNNDir
>  fails on Windows with below error message:
> NN dir should be created after NN startup. 
> expected:<[F:\short\hadoop-trunk-win\s\hadoop-hdfs-project\hadoop-hdfs\target\test\data\3\dfs\testNNFailToStartOnReadOnlyNNDir\]name>
>  but 
> was:<[/F:/short/hadoop-trunk-win/s/hadoop-hdfs-project/hadoop-hdfs/target/test/data/3/dfs/testNNFailToStartOnReadOnlyNNDir/]name>
> due to path not processed properly on Windows.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to