[
https://issues.apache.org/jira/browse/HDFS-7917?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14376246#comment-14376246
]
Chris Nauroth commented on HDFS-7917:
-------------------------------------
Hi [~eddyxu]. Thank you for the patch.
Unfortunately, I just remembered that the rename isn't going to work on
Windows. It typically doesn't allow you to rename a directory where there are
open file handles anywhere in the sub-tree. We'd have to shutdown the DataNode
before doing the rename and then start it up. By doing that, we'd be changing
the meaning of the test from covering an online failure to covering a failure
at DataNode startup, so I don't think we can make that change.
At this point, I think we can either abandon this patch and stick with the plan
of using {[git clean}} to clean up test directories between Jenkins runs, or if
you still want to get this change in anyway as an extra safeguard, then I have
no objection. If you still want to go ahead with this patch, then I do
recommend checking all of the {{renameTo}} and {{createNewFile}} return values.
If they return {{false}}, then throw an {{IOException}}.
> Use file to replace data dirs in test to simulate a disk failure.
> ------------------------------------------------------------------
>
> Key: HDFS-7917
> URL: https://issues.apache.org/jira/browse/HDFS-7917
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: test
> Affects Versions: 2.6.0
> Reporter: Lei (Eddy) Xu
> Assignee: Lei (Eddy) Xu
> Priority: Minor
> Attachments: HDFS-7917.000.patch, HDFS-7917.001.patch
>
>
> Currently, in several tests, e.g., {{TestDataNodeVolumeFailureXXX}} and
> {{TestDataNotHowSwapVolumes}}, we simulate a disk failure by setting a
> directory's executable permission as false. However, it raises the risk that
> if the cleanup code could not be executed, the directory can not be easily
> removed by Jenkins job.
> Since in {{DiskChecker#checkDirAccess}}:
> {code}
> private static void checkDirAccess(File dir) throws DiskErrorException {
> if (!dir.isDirectory()) {
> throw new DiskErrorException("Not a directory: "
> + dir.toString());
> }
> checkAccessByFileMethods(dir);
> }
> {code}
> We can replace the DN data directory as a file to achieve the same fault
> injection goal, while it is safer for cleaning up in any circumstance.
> Additionally, as [~cnauroth] suggested:
> bq. That might even let us enable some of these tests that are skipped on
> Windows, because Windows allows access for the owner even after permissions
> have been stripped.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)