From hdfs-issues-return-264307-apmail-hadoop-hdfs-issues-archive=hadoop.apache.org@hadoop.apache.org Mon May 27 11:42:08 2019 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 [207.244.88.153]) by minotaur.apache.org (Postfix) with SMTP id AAB7119FBA for ; Mon, 27 May 2019 11:42:07 +0000 (UTC) Received: (qmail 82223 invoked by uid 500); 27 May 2019 11:42:06 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 82183 invoked by uid 500); 27 May 2019 11:42:06 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 82172 invoked by uid 99); 27 May 2019 11:42:06 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 May 2019 11:42:06 +0000 Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 21C6AE2CA1 for ; Mon, 27 May 2019 11:42:03 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 7526425818 for ; Mon, 27 May 2019 11:42:00 +0000 (UTC) Date: Mon, 27 May 2019 11:42:00 +0000 (UTC) From: "Shashikant Banerjee (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HDFS-14499) Misleading REM_QUOTA value with snasphot and trash feature enabled for a directory MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HDFS-14499?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:all-tabpanel ] Shashikant Banerjee updated HDFS-14499: --------------------------------------- Status: Patch Available (was: Open) > Misleading REM_QUOTA value with snasphot and trash feature enabled for a = directory > -------------------------------------------------------------------------= --------- > > Key: HDFS-14499 > URL: https://issues.apache.org/jira/browse/HDFS-14499 > Project: Hadoop HDFS > Issue Type: Bug > Components: snapshots > Reporter: Shashikant Banerjee > Assignee: Shashikant Banerjee > Priority: Major > Attachments: HDFS-14499.000.patch > > > This is the flow of steps where we see a discrepancy between REM_QUOTA an= d new file operation failure. REM_QUOTA shows a value of=C2=A0 1 but file c= reation operation does not succeed. > {code:java} > hdfs@c3265-node3 root$ hdfs dfs -mkdir /dir1 > hdfs@c3265-node3 root$ hdfs dfsadmin -setQuota 2 /dir1 > hdfs@c3265-node3 root$ hdfs dfsadmin -allowSnapshot /dir1 > Allowing snaphot on /dir1 succeeded > hdfs@c3265-node3 root$ hdfs dfs -touchz /dir1/file1 > hdfs@c3265-node3 root$ hdfs dfs -createSnapshot /dir1 snap1 > Created snapshot /dir1/.snapshot/snap1 > hdfs@c3265-node3 root$ hdfs dfs -count -v -q /dir1 > QUOTA REM_QUOTA SPACE_QUOTA REM_SPACE_QUOTA DIR_COUNT FILE_COUNT CONTENT_= SIZE PATHNAME > 2 0 none inf 1 1 0 /dir1 > hdfs@c3265-node3 root$ hdfs dfs -rm /dir1/file1 > 19/03/26 11:20:25 INFO fs.TrashPolicyDefault: Moved: 'hdfs://smajetinn/di= r1/file1' to trash at: hdfs://smajetinn/user/hdfs/.Trash/Current/dir1/file1= 1553599225772 > hdfs@c3265-node3 root$ hdfs dfs -count -v -q /dir1 > QUOTA REM_QUOTA SPACE_QUOTA REM_SPACE_QUOTA DIR_COUNT FILE_COUNT CONTENT_= SIZE PATHNAME > 2 1 none inf 1 0 0 /dir1 > hdfs@c3265-node3 root$ hdfs dfs -touchz /dir1/file1 > touchz: The NameSpace quota (directories and files) of directory /dir1 is= exceeded: quota=3D2 file count=3D3{code} > The issue here, is that the count command takes only files and directorie= s into account not the inode references. When trash is enabled, the deletio= n of files inside a directory actually does a rename operation as a result = of which an inode reference is maintained in the deleted list of the snapsh= ot diff which is taken into account while computing the namespace quota, bu= t count command (getContentSummary()) ,just takes into account just the fil= es and directories, not the referenced entity for calculating the REM_QUOTA= . The referenced entity is taken into account for space quota only. > InodeReference.java: > ------------------- > {code:java} > @Override > public final ContentSummaryComputationContext computeContentSummary( > int snapshotId, ContentSummaryComputationContext summary) { > final int s =3D snapshotId < lastSnapshotId ? snapshotId : lastSnap= shotId; > // only count storagespace for WithName > final QuotaCounts q =3D computeQuotaUsage( > summary.getBlockStoragePolicySuite(), getStoragePolicyID(), fal= se, s); > summary.getCounts().addContent(Content.DISKSPACE, q.getStorageSpace= ()); > summary.getCounts().addTypeSpaces(q.getTypeSpaces()); > return summary; > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org