[ https://issues.apache.org/jira/browse/HDFS-7056?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14201410#comment-14201410 ]
Plamen Jeliazkov commented on HDFS-7056: ---------------------------------------- Regarding (4), I see two issues right now. INodeFile.diskspaceConsumed() has always done its calculation based on the current INodeFile blocks list. Prior to truncate, it was assumed the file only grew, so diskspaceConsumed was always correct based on the current INodeFile blocks list. With truncate now, especially with copy-on-truncate and certain blocks living only in Snapshot diffs, diskspaceConsumed becomes a question. Is INodeFile.diskspaceConsumed() meant to only return the disk space consumed of just the current/latest INodeFile (as it currently does)? Or should it go through its diffs and return the disk space consumed of all blocks that belong to this BlockCollection? I could not find any documentation for diskspaceConsumed() method. Based on the code I see in INodeFile.computeContentSummary4Snapshot(), it seems Snapshot diffs are only calculated towards disk space when the latest INodeFile has been deleted. The disk space consumed calculation falls back to the last diff that was known about. > Snapshot support for truncate > ----------------------------- > > Key: HDFS-7056 > URL: https://issues.apache.org/jira/browse/HDFS-7056 > Project: Hadoop HDFS > Issue Type: Sub-task > Components: namenode > Affects Versions: 3.0.0 > Reporter: Konstantin Shvachko > Assignee: Plamen Jeliazkov > Attachments: HDFS-3107-HDFS-7056-combined.patch, HDFS-7056.patch, > HDFS-7056.patch, HDFSSnapshotWithTruncateDesign.docx > > > Implementation of truncate in HDFS-3107 does not allow truncating files which > are in a snapshot. It is desirable to be able to truncate and still keep the > old file state of the file in the snapshot. -- This message was sent by Atlassian JIRA (v6.3.4#6332)