[ https://issues.apache.org/jira/browse/HDFS-8982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14724094#comment-14724094 ]
Jing Zhao edited comment on HDFS-8982 at 8/31/15 9:44 PM: ---------------------------------------------------------- Actually I think for both the if and else section, it's better to use {{getFileReplication}} instead of {{getPreferredBlockReplication}}. This is because we're adding new blocks, which are not included in any historical snapshot. For these blocks, the replication factor should be the file's current replication factor, instead of the max replication factor. In the past we always used the preferred/max replication factor for all the blocks in the file. This can simplify the quota calculation. Now since the block has replication factor, it may be better to allow blocks belonging to the same file to have different replication factor, based on which snapshots they belong to. But looks like the current code does not have consistent semantic. {{getFileReplication}} and {{getPreferredBlockReplication}} are kind of randomly mixed in quota usage and block allocation. Maybe we should use this change/jira to clean up this part (and either semantic is fine with me). was (Author: jingzhao): Actually I think here it's better to use {{getFileReplication}} instead of {{getPreferredBlockReplication}}. This is because we're adding new blocks, which are not included in any historical snapshot. For these blocks, the replication factor should be the file's current replication factor, instead of the max replication factor. But looks like the current code does not have consistent semantic. {{getFileReplication}} and {{getPreferredBlockReplication}} are mixed in quota usage and block allocation. Maybe we should use this change/jira to clean up this part. > Consolidate getFileReplication and getPreferredBlockReplication in INodeFile > ---------------------------------------------------------------------------- > > Key: HDFS-8982 > URL: https://issues.apache.org/jira/browse/HDFS-8982 > Project: Hadoop HDFS > Issue Type: Improvement > Components: namenode > Affects Versions: 2.7.1 > Reporter: Zhe Zhang > > Currently {{INodeFile}} provides both {{getFileReplication}} and > {{getPreferredBlockReplication}} interfaces. At the very least they should be > renamed (e.g. {{getCurrentFileReplication}} and > {{getMaxConfiguredFileReplication}}), with clearer Javadoc. > I also suspect we are not using them correctly in all places right now. -- This message was sent by Atlassian JIRA (v6.3.4#6332)