[
https://issues.apache.org/jira/browse/HDFS-7826?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14347812#comment-14347812
]
Zhe Zhang commented on HDFS-7826:
---------------------------------
Oops I didn't realize this JIRA handles {{computeFileSize}}. I was about to
suggest the following code under HDFS-7749.
{code}
public final long computeFileSize(boolean includesLastUcBlock,
boolean usePreferredBlockSize4LastUcBlock) {
BlockInfo[] blocksInfile = isStriped() ?
getStripedBlocksFeature().getBlocks() : blocks;
if (blocksInfile == null || blocksInfile.length == 0) {
return 0;
}
final int last = blocksInfile.length - 1;
//check if the last block is BlockInfoUnderConstruction
long size = blocksInfile[last].getNumBytes();
if (blocksInfile[last] instanceof BlockInfoContiguousUnderConstruction ||
blocksInfile[last] instanceof BlockInfoStripedUnderConstruction) {
if (!includesLastUcBlock) {
size = 0;
} else if (usePreferredBlockSize4LastUcBlock) {
size = getPreferredBlockSize();
}
}
//sum other blocks
for(int i = 0; i < last; i++) {
size += blocksInfile[i].getNumBytes();
}
return size;
}
{code}
> Erasure Coding: Update INodeFile quota computation for striped blocks
> ---------------------------------------------------------------------
>
> Key: HDFS-7826
> URL: https://issues.apache.org/jira/browse/HDFS-7826
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Reporter: Jing Zhao
> Assignee: Kai Sasaki
> Attachments: HDFS-7826.1.patch
>
>
> Currently INodeFile's quota computation only considers contiguous blocks
> (i.e., {{INodeFile#blocks}}). We need to update it to support striped blocks.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)