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

Andrew Wang commented on HDFS-6422:
-----------------------------------

Hey Charles, thanks for working on this. I had a few review comments:

* I see you did some cleanup in XAttrCommands. I think we need to move the 
{{out.println(header)}} in the first if statement up by one line. We should 
still print the header as long as the file exists, even if it doesn't have any 
xattrs.
* There are a couple issues with the exception logic in FSNamesystem. One is if 
the user asks for an xattr in either an unknown or disallowed namespace. 
Another is if the user asks for multiple xattrs and one of them is not present. 
The filtering makes sense for the {{getAll}} case, but for the other case, we 
need to throw if a specifically requested xattr is not available or present.
* We could actually do the bulk of this testing in the Java API, since the 
shell sets the error code on an exception. The Java API is better since it's 
faster, more concise, and lets us more easily verify expected exceptions and 
return values. We could have a short sanity test with the shell, but it can't 
handle things like requesting multiple xattrs right now.

> getfattr in CLI doesn't throw exception or return non-0 return code when 
> xattr doesn't exist
> --------------------------------------------------------------------------------------------
>
>                 Key: HDFS-6422
>                 URL: https://issues.apache.org/jira/browse/HDFS-6422
>             Project: Hadoop HDFS
>          Issue Type: Bug
>    Affects Versions: HDFS XAttrs (HDFS-2006)
>            Reporter: Charles Lamb
>            Assignee: Charles Lamb
>         Attachments: HDFS-6422.1.patch
>
>
> If you do
> hdfs dfs -getfattr -n user.blah /foo
> and user.blah doesn't exist, the command prints
> # file: /foo
> and a 0 return code.
> It should print an exception and return a non-0 return code instead.



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

Reply via email to