[
https://issues.apache.org/jira/browse/HDFS-6299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13985312#comment-13985312
]
Fengdong Yu commented on HDFS-6299:
-----------------------------------
1.
{code}
+ public byte[] getXAttr(String src, String name) throws IOException {
+ checkOpen();
+ try {
+ XAttr xAttr = buildXAttr(name, null);
+ List<XAttr> xAttrs = Lists.newArrayListWithCapacity(1);
+ xAttrs.add(xAttr);
+ List<XAttr> result = namenode.getXAttrs(src, xAttrs);
+ byte[] value = null;
+ if (result != null && result.size() > 0) {
+ XAttr a = result.get(0);
+ value = a.getValue();
+ if (value == null) {
+ value = new byte[0]; //xattr exists, but no value.
+ }
+ }
+ return value;
+ } catch(RemoteException re) {
{code}
It looks like you don't want to return null here? so if result is null or
empty, It still return null
Another, try to use !result.isEmpty(), instead of 'result.size() > 0'
2.
ClientRPC interface is not symmetrical, there are getXAttr(), getXAttrs(),
setXAttr(), so there should be setXAttrs().
3.
why there is no getXAttr() in the ClientProtocol? we should allow to get only
one xattr in one time.
> Protobuf for XAttr and client-side implementation
> --------------------------------------------------
>
> Key: HDFS-6299
> URL: https://issues.apache.org/jira/browse/HDFS-6299
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: hdfs-client, namenode
> Affects Versions: HDFS XAttrs (HDFS-2006)
> Reporter: Uma Maheswara Rao G
> Assignee: Yi Liu
> Fix For: HDFS XAttrs (HDFS-2006)
>
> Attachments: HDFS-6299.patch
>
>
> This JIRA tracks Protobuf for XAttr and implementation for XAttr interfaces
> in DistributedFilesystem and DFSClient.
> With this JIRA we may just keep the dummy implemenation for Xattr API of
> ClientProtocol in NameNodeRpcServer
--
This message was sent by Atlassian JIRA
(v6.2#6252)