hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lei (Eddy) Xu (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HDFS-5546) race condition crashes "hadoop ls -R" when directories are moved/removed
Date Fri, 20 Jun 2014 00:46:25 GMT

     [ https://issues.apache.org/jira/browse/HDFS-5546?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Lei (Eddy) Xu updated HDFS-5546:
--------------------------------

    Attachment: HDFS-5546.2.003.patch

This patch absorts FNF exception but in the end, it prints out a warning message to suggest
users to re-run {{ls}}. The print format is something like the following:

{quote}
drw-rw-rw-   - test test       1024 1969-12-31 16:00 mockfs:///test/dir0
drw-rw-rw-   - test test       1024 1969-12-31 16:00 mockfs:///test/dir1
drw-rw-rw-   - test test       1024 1969-12-31 16:00 mockfs:///test/dir2
drw-rw-rw-   - test test       1024 1969-12-31 16:00 mockfs:///test/dir3
drw-rw-rw-   - test test       1024 1969-12-31 16:00 mockfs:///test/dir4
drw-rw-rw-   - test test       1024 1969-12-31 16:00 mockfs:///test/dir5
drw-rw-rw-   - test test       1024 1969-12-31 16:00 mockfs:///test/dir6
drw-rw-rw-   - test test       1024 1969-12-31 16:00 mockfs:///test/dir7
drw-rw-rw-   - test test       1024 1969-12-31 16:00 mockfs:///test/dir8
drw-rw-rw-   - test test       1024 1969-12-31 16:00 mockfs:///test/dir9
-rw-rw-rw-   1 test test       1024 1969-12-31 16:00 mockfs:///other/file
Warning: Files are deleted or renamed during running this command. Suggest to re-run this
command.
{quote}

Actually, all {{/test/dir#<even_num>}} are deleted, but they are printed anyway. The
reason is that {{ls}} firstly prints out the current directory, then jumps into the sub-directory
recursively, there is no cheap way to test the existence  of the current directory before
printing its information. 

I think in this case, we should not directly catch IOExecption and {{displayError(e)}}. {{LS}}
command should be tolerate this scenario without generating too much noise.  



> race condition crashes "hadoop ls -R" when directories are moved/removed
> ------------------------------------------------------------------------
>
>                 Key: HDFS-5546
>                 URL: https://issues.apache.org/jira/browse/HDFS-5546
>             Project: Hadoop HDFS
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Colin Patrick McCabe
>            Assignee: Lei (Eddy) Xu
>            Priority: Minor
>             Fix For: 3.0.0
>
>         Attachments: HDFS-5546.1.patch, HDFS-5546.2.000.patch, HDFS-5546.2.001.patch,
HDFS-5546.2.002.patch, HDFS-5546.2.003.patch
>
>
> This seems to be a rare race condition where we have a sequence of events like this:
> 1. org.apache.hadoop.shell.Ls calls DFS#getFileStatus on directory D.
> 2. someone deletes or moves directory D
> 3. org.apache.hadoop.shell.Ls calls PathData#getDirectoryContents(D), which calls DFS#listStatus(D).
This throws FileNotFoundException.
> 4. ls command terminates with FNF



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message