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

Manoj Govindassamy commented on HADOOP-13721:
---------------------------------------------


{{Expunge}} works with {{ViewFileSystem}}.

The way Expunge works is 
{code}
    @Override
    protected void processArguments(LinkedList<PathData> args)
    throws IOException {
      FileSystem[] childFileSystems =
          FileSystem.get(getConf()).getChildFileSystems();
      if (null != childFileSystems) {
        for (FileSystem fs : childFileSystems) {
          Trash trash = new Trash(fs, getConf());
          trash.expunge();
          trash.checkpoint();
        }
      } else {
      ... 
    }
{code}

Since {{ViewFileSystem}} implements getChildFileSystems() and exports all the 
mounted file systems, expunge is invoked on the all these mounted filesystems.

{noformat}
manoj@~/work/test/hadev-mg(master)*: hdfs dfs -ls /
Found 4 items
-r-xr-xr-x   - manoj staff          0 2016-10-14 11:30 /nn0
-r-xr-xr-x   - manoj staff          0 2016-10-14 11:30 /nn1
-r-xr-xr-x   - manoj staff          0 2016-10-14 11:30 /nn2
-r-xr-xr-x   - manoj staff          0 2016-10-14 11:30 /nn3
manoj@~/work/test/hadev-mg(master)*: hdfs dfs -ls /nn0
Found 1 items
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:27 /nn0/user
manoj@~/work/test/hadev-mg(master)*: hdfs dfs -ls -R /nn0
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:27 /nn0/user
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:27 /nn0/user/manoj
manoj@~/work/test/hadev-mg(master)*: hdfs dfs -mkdir -p /nn0/delete/test1
manoj@~/work/test/hadev-mg(master)*: hdfs dfs -mkdir -p /nn0/delete/test2
manoj@~/work/test/hadev-mg(master)*: hdfs dfs -ls -R /nn0
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:31 /nn0/delete
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:31 /nn0/delete/test1
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:31 /nn0/delete/test2
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:27 /nn0/user
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:27 /nn0/user/manoj
manoj@~/work/test/hadev-mg(master)*: hdfs dfs -rm -r /nn0/delete/test1
manoj@~/work/test/hadev-mg(master)*: hdfs dfs -ls -R /nn0
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:32 /nn0/delete
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:31 /nn0/delete/test2
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:27 /nn0/user
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:32 /nn0/user/manoj
drwx------   - manoj supergroup          0 2016-10-14 11:32 
/nn0/user/manoj/.Trash
drwx------   - manoj supergroup          0 2016-10-14 11:32 
/nn0/user/manoj/.Trash/Current
drwx------   - manoj supergroup          0 2016-10-14 11:32 
/nn0/user/manoj/.Trash/Current/delete
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:31 
/nn0/user/manoj/.Trash/Current/delete/test1
manoj@~/work/test/hadev-mg(master)*: hdfs dfs -rm -r -skipTrash 
/nn0/delete/test2
Deleted /nn0/delete/test2
manoj@~/work/test/hadev-mg(master)*: hdfs dfs -ls -R /nn0
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:33 /nn0/delete
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:27 /nn0/user
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:32 /nn0/user/manoj
drwx------   - manoj supergroup          0 2016-10-14 11:32 
/nn0/user/manoj/.Trash
drwx------   - manoj supergroup          0 2016-10-14 11:32 
/nn0/user/manoj/.Trash/Current
drwx------   - manoj supergroup          0 2016-10-14 11:32 
/nn0/user/manoj/.Trash/Current/delete
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:31 
/nn0/user/manoj/.Trash/Current/delete/test1
manoj@~/work/test/hadev-mg(master)*: hdfs dfs -expunge
manoj@~/work/test/hadev-mg(master)*: hdfs dfs -ls -R /nn0
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:33 /nn0/delete
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:27 /nn0/user
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:32 /nn0/user/manoj
drwx------   - manoj supergroup          0 2016-10-14 11:34 
/nn0/user/manoj/.Trash
drwx------   - manoj supergroup          0 2016-10-14 11:32 
/nn0/user/manoj/.Trash/161014113451
drwx------   - manoj supergroup          0 2016-10-14 11:32 
/nn0/user/manoj/.Trash/161014113451/delete
drwxr-xr-x   - manoj supergroup          0 2016-10-14 11:31 
/nn0/user/manoj/.Trash/161014113451/delete/test1
{noformat}



> Remove stale method ViewFileSystem#getTrashCanLocation
> ------------------------------------------------------
>
>                 Key: HADOOP-13721
>                 URL: https://issues.apache.org/jira/browse/HADOOP-13721
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 3.0.0-alpha2
>            Reporter: Manoj Govindassamy
>            Assignee: Manoj Govindassamy
>            Priority: Minor
>         Attachments: HADOOP-13721.01.patch
>
>
> {{ViewFileSystem}} which extends {{FileSystem}} has a public method 
> {{getTrashCanLocation}} which is neither overridden nor used by anybody. 
> Looks like it existed when the file was created, and also I see the 
> implementation returning homeDirectory which might not be the expected one in 
> cases of {{expunge}}. So, inclined to remove this stale and potentially 
> dangerous method unless anyone has any concerns. 
> {code}
>   public Path getTrashCanLocation(final Path f) throws FileNotFoundException {
>     final InodeTree.ResolveResult<FileSystem> res = 
>       fsState.resolve(getUriPath(f), true);
>     return res.isInternalDir() ? null : 
> res.targetFileSystem.getHomeDirectory();
>   }
> {code}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to