hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Nauroth (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-6414) xattr modification operations are based on state of latest snapshot instead of current version of inode.
Date Fri, 16 May 2014 11:01:35 GMT

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

Chris Nauroth commented on HDFS-6414:
-------------------------------------

See below for a CLI transcript showing one example of the bug.  The expected end result is
that the setfattr -x removes the user.foo xattr.  It doesn't work, because it reads the state
of the inode's most recent snapshot, which was created before an {{XAttrFeature}} was attached
to the inode.  This causes it to skip the call to {{INode#removeXAttrFeature}}.

I expect the fix is to change {{XAttrStorage#updateINodeXAttrs}} so that it doesn't pass the
latest snapshot ID in the 2 calls to {{INode#getXAttrFeature}}.  (Call the no-args overload
instead.)  This will read the latest version of the inode state.

Let's also add unit tests covering this case.  See {{TestAclWithSnapshot#testModifyReadsCurrentState}}
and {{TestAclWithSnapshot#testRemoveReadsCurrentState}} for inspiration.  The important thing
about these tests is to create a snapshot first, before adding any xattrs.  The current tests
in {{TestXAttrWithSnapshot}} all add the xattrs before creating a snapshot, which is why this
particular bug wasn't caught.

Thanks to [~jingzhao] for reviewing my findings before I filed the issue.

{code}
> hadoop-3.0.0-SNAPSHOT/bin/hdfs dfs -mkdir /testSnapshotWithXattr

> hadoop-3.0.0-SNAPSHOT/bin/hdfs dfsadmin -allowSnapshot /testSnapshotWithXattr
Allowing snaphot on /testSnapshotWithXattr succeeded

> hadoop-3.0.0-SNAPSHOT/bin/hdfs dfs -createSnapshot /testSnapshotWithXattr snap1
Created snapshot /testSnapshotWithXattr/.snapshot/snap1

> hadoop-3.0.0-SNAPSHOT/bin/hdfs dfs -setfattr -n user.foo /testSnapshotWithXattr

> hadoop-3.0.0-SNAPSHOT/bin/hdfs dfs -getfattr -d /testSnapshotWithXattr
# file: /testSnapshotWithXattr
user.foo

> hadoop-3.0.0-SNAPSHOT/bin/hdfs dfs -setfattr -x user.foo /testSnapshotWithXattr

> hadoop-3.0.0-SNAPSHOT/bin/hdfs dfs -getfattr -d /testSnapshotWithXattr
# file: /testSnapshotWithXattr
user.foo
{code}


> xattr modification operations are based on state of latest snapshot instead of current
version of inode.
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-6414
>                 URL: https://issues.apache.org/jira/browse/HDFS-6414
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: namenode
>    Affects Versions: HDFS XAttrs (HDFS-2006)
>            Reporter: Chris Nauroth
>             Fix For: HDFS XAttrs (HDFS-2006)
>
>         Attachments: hdfs-6414.1.patch, hdfs-6414.2.patch
>
>
> {{XAttrStorage#updateINodeXAttrs}} modifies the inode's {{XAttrFeature}} based on reading
its current state.  However, the logic for reading current state is incorrect and may instead
read the state of the latest snapshot.  If xattrs have been changed after creation of that
snapshot, then subsequent xattr operations may yield incorrect results.



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

Mime
View raw message