Return-Path: X-Original-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B35DE11704 for ; Fri, 16 May 2014 19:00:41 +0000 (UTC) Received: (qmail 98898 invoked by uid 500); 16 May 2014 11:22:37 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 44080 invoked by uid 500); 16 May 2014 11:13:09 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-issues@hadoop.apache.org Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 7561 invoked by uid 99); 16 May 2014 11:01:35 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 May 2014 11:01:35 +0000 Date: Fri, 16 May 2014 11:01:35 +0000 (UTC) From: "Chris Nauroth (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-6414) xattr modification operations are based on state of latest snapshot instead of current version of inode. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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)