You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Siyao Meng (JIRA)" <ji...@apache.org> on 2019/03/15 21:25:00 UTC

[jira] [Comment Edited] (HADOOP-13656) fs -expunge to take a filesystem

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

Siyao Meng edited comment on HADOOP-13656 at 3/15/19 9:24 PM:
--------------------------------------------------------------

[~liuml07] Thanks for the comment.

[~shwetayakkali]
1. Sorry for the confusion. Let me elaborate. Since class CommandFormat initializer could take multiple Strings, I meant instead of
{code:java}
    @Override
    protected void processOptions(LinkedList<String> args) throws IOException {
      CommandFormat cf = new CommandFormat(0, 1, "immediate");
      cf.addOptionWithValue(OPTION_FILESYSTEM);
      cf.parse(args);
...
{code}

You could use
{code:java}
    @Override
    protected void processOptions(LinkedList<String> args) throws IOException {
      CommandFormat cf = new CommandFormat(0, 2, "immediate", OPTION_FILESYSTEM);
      cf.parse(args);
...
{code}

1.5 Note the second argument in CommandFormat's initializer indicates the maximum argument it can take. So it should be increased from "1" to "2", as shown above. Or it would throw "Too many arguments" exception when "immediate" and "fs" are BOTH given at the command line. We should add one more test case for this. I've written one based on yours:
{code:java}
    // Adding both filesystem argument and immediate to expunge
    {
      String[] args = new String[4];
      args[0] = "-expunge";
      args[1] = "-immediate";
      args[2] = "-fs";
      args[3] = "file:///";
      int val = -1;
      try {
        val = shell.run(args);
      } catch (Exception e) {
        System.err.println("Exception raised from Trash.run " +
                e.getLocalizedMessage());
      }
      assertEquals(val, 0);
    }
{code}

4. You could also remove the TODO above this function since this jira implements it. :)


was (Author: smeng):
[~liuml07] Thanks for the comment.

[~shwetayakkali]
1. Sorry for the confusion. Let me elaborate. Since class CommandFormat initializer could take multiple Strings, I meant instead of
{code:java}
    @Override
    protected void processOptions(LinkedList<String> args) throws IOException {
      CommandFormat cf = new CommandFormat(0, 1, "immediate");
      cf.addOptionWithValue(OPTION_FILESYSTEM);
      cf.parse(args);
...
{code}

You could use
{code:java}
    @Override
    protected void processOptions(LinkedList<String> args) throws IOException {
      CommandFormat cf = new CommandFormat(0, 2, "immediate", OPTION_FILESYSTEM);
      cf.parse(args);
...
{code}

1.5 Note the second argument in CommandFormat's initializer indicates the maximum argument it can take. So it should be increased from "1" to "2", as shown above. Or it would throw "Too many arguments" exception when "immediate" and "fs" are BOTH given at the command line. Test case for this based on yours:
{code:java}
    // Adding both filesystem argument and immediate to expunge
    {
      String[] args = new String[4];
      args[0] = "-expunge";
      args[1] = "-immediate";
      args[2] = "-fs";
      args[3] = "file:///";
      int val = -1;
      try {
        val = shell.run(args);
      } catch (Exception e) {
        System.err.println("Exception raised from Trash.run " +
                e.getLocalizedMessage());
      }
      assertEquals(val, 0);
    }
{code}

4. You could also remove the TODO above this function since this jira implements it. :)

> fs -expunge to take a filesystem
> --------------------------------
>
>                 Key: HADOOP-13656
>                 URL: https://issues.apache.org/jira/browse/HADOOP-13656
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs
>    Affects Versions: 2.7.3
>            Reporter: Steve Loughran
>            Assignee: Shweta
>            Priority: Minor
>         Attachments: HADOOP-13656.001.patch, HADOOP-13656.002.patch, HADOOP-13656.003.patch, HADOOP-13656.004.patch
>
>
> you can't pass in a filesystem or object store to {{fs -expunge}; you have to change the default fs
> {code}
> hadoop fs -expunge -D fs.defaultFS=s3a://bucket/
> {code}
> If the command took an optional filesystem argument, it'd be better at cleaning up object stores. Given that even deleted object store data runs up bills, this could be appreciated.



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

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