[
https://issues.apache.org/jira/browse/HDFS-7056?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14211635#comment-14211635
]
Colin Patrick McCabe commented on HDFS-7056:
--------------------------------------------
The design doc makes sense to me-- thanks for spelling it all out. I'm afraid
I can't see some of the pictures because I don't have MS Windows or MS Office.
Maybe you can attach a PDF at some point?
Did you consider a design where the inode ID of the truncated file changes?
That might simplify some things... In that case, we would be treating
truncated files a lot like files that been deleted and then re-created with the
same name. On the other hand, perhaps the current design can achieve higher
memory efficiency?
{code}
635 * @return true if and client does not need to wait for block recovery,
636 * false if client needs to wait for block recovery.
{code}
There is an extra "if and" in this comment.
{code}
+ /**
+ * Check if this block has the same id, genStamp, and numBytes as the other.
+ */
+ public boolean sameAs(Block other) {
+ return matchingIdAndGenStamp(this, other) &&
+ getNumBytes() == other.getNumBytes();
+ }
{code}
I'd prefer not to add this method, since it's only used once in a unit test.
And we already have {{Block#equals}} and {{Block#compareTo}}.
I can see we're creating a lease while the new last block of the file is
created (or the current last block is truncated.) How does this interact with
{{recoverLease}}? If the client calls {{recoverLease}} on this file that is
being truncated, will the system still be in a reasonable state?
> 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-3107-HDFS-7056-combined.patch, HDFS-3107-HDFS-7056-combined.patch,
> HDFS-3107-HDFS-7056-combined.patch, HDFS-7056.patch, HDFS-7056.patch,
> HDFS-7056.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)