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

Mingliang Liu commented on HDFS-10415:
--------------------------------------

Hi [~cmccabe],

Thanks for the comment. Your proposal is a bit similar to my solution 2 (see 
the comment above).

The problem is that, though it's indeed more nature fix, the {{initialize()}} 
method is never called after {{MyDistributedFileSystem}} is constructed. This 
is because, the object is not created by the static factory method 
{{FileSystem#get()}}. As a result, justing implementing the {{initialize()}} is 
not able to work. We have to call it.
As to implementation,
# the {{dfs}} object is mocked in the {{MyDistributedFileSystem}} constructor. 
The {{DistributedFileSystem#initialize()}} method will reset this value, which 
is expected generally. We need to mock the {{dfs}} in the {{initialize()}} 
after calling {{super.initialize()}}
# {{super.initialize()}} will take care of the {{statistics}} and 
{{storageStatistics}} so we don't need to create it explicitly after that I 
believe?

As [[email protected]]'s concern, if the stats has nothing to do with this 
unit test, we can consider avoiding it. I'm more favor of this approach.

My concern is that, why the {{trunk}} and {{branch-2}} have the code difference 
as following? If the javadoc is true, it should stand for both of the branches. 
I must have missed something?
{code}
+    // Symlink resolution doesn't work with a mock, since it doesn't
+    // have a valid Configuration to resolve paths to the right FileSystem.
+    // Just call the DFSClient directly to register the delete
+    @Override
+    public boolean delete(Path f, final boolean recursive) throws IOException {
+      return dfs.delete(f.toUri().getPath(), recursive);
+    }
{code}

> TestDistributedFileSystem#testDFSCloseOrdering() fails on branch-2
> ------------------------------------------------------------------
>
>                 Key: HDFS-10415
>                 URL: https://issues.apache.org/jira/browse/HDFS-10415
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: test
>    Affects Versions: 2.9.0
>         Environment: jenkins
>            Reporter: Sangjin Lee
>            Assignee: Mingliang Liu
>         Attachments: HDFS-10415-branch-2.000.patch, 
> HDFS-10415-branch-2.001.patch, HDFS-10415.000.patch
>
>
> {noformat}
> Tests run: 24, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 51.096 sec 
> <<< FAILURE! - in org.apache.hadoop.hdfs.TestDistributedFileSystem
> testDFSCloseOrdering(org.apache.hadoop.hdfs.TestDistributedFileSystem)  Time 
> elapsed: 0.045 sec  <<< ERROR!
> java.lang.NullPointerException: null
>       at 
> org.apache.hadoop.hdfs.DistributedFileSystem.delete(DistributedFileSystem.java:790)
>       at 
> org.apache.hadoop.fs.FileSystem.processDeleteOnExit(FileSystem.java:1417)
>       at org.apache.hadoop.fs.FileSystem.close(FileSystem.java:2084)
>       at 
> org.apache.hadoop.hdfs.DistributedFileSystem.close(DistributedFileSystem.java:1187)
>       at 
> org.apache.hadoop.hdfs.TestDistributedFileSystem.testDFSCloseOrdering(TestDistributedFileSystem.java:217)
> {noformat}
> This is with Java 8 on Mac. It passes fine on trunk. I haven't tried other 
> combinations. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to