[ 
https://issues.apache.org/jira/browse/HDFS-7866?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15184267#comment-15184267
 ] 

Walter Su commented on HDFS-7866:
---------------------------------

1. Not only javadoc, what I mean was separating the logic of manipulation of 
the 12-bits. 2 sets of set/get methods for them. Now the cuts are both (1,11), 
it's just the meanings of each part are different. But what if in the future 
the cut is different? You have the same concern about unifying set method:
bq. 3. The biggest concern is INodeFile constructor – related to that, the 
toLong method. Currently when isStriped, we just interpret replication as the 
EC policy ID. This looks pretty hacky. But it looks pretty tricky to fix. 

By the way, if we're planning use unified cut (1,11) for both of them, why 
bother having one enum item BLOCK_LAYOUT_AND_REDUNDANCY(12-bits) and do the bit 
masking by myself, insead of 2 enum items as before which does the bit masking 
for us.

Some nits:
1. {{LAYOUT_BIT_WIDTH}}, {{MAX_REDUNDANCY}} can be private inside 
{{HeaderFormat}}.

2. 
{code}
  /**
   * @return The ID of the erasure coding policy on the file. -1 represents no
   *          EC policy.
   */
  @VisibleForTesting
  @Override
  public byte getErasureCodingPolicyID() {
    if (isStriped()) {
      return (byte) HeaderFormat.getReplication(header);
    }
    return -1;
  }
{code}
{code}
     // check if the file has an EC policy
      ErasureCodingPolicy ecPolicy = FSDirErasureCodingOp.
          getErasureCodingPolicy(fsd.getFSNamesystem(), existing);
      if (ecPolicy != null) {
        replication = ecPolicy.getId();
      }
{code}
We are sure policyID is strictly <=7-bits right? Casting an ID with value >=128 
to byte becomes negative, then the logic gets wild. Vice versa.

> Erasure coding: NameNode manages multiple erasure coding policies
> -----------------------------------------------------------------
>
>                 Key: HDFS-7866
>                 URL: https://issues.apache.org/jira/browse/HDFS-7866
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Kai Zheng
>            Assignee: Rui Li
>         Attachments: HDFS-7866-v1.patch, HDFS-7866-v2.patch, 
> HDFS-7866-v3.patch, HDFS-7866.10.patch, HDFS-7866.11.patch, 
> HDFS-7866.12.patch, HDFS-7866.4.patch, HDFS-7866.5.patch, HDFS-7866.6.patch, 
> HDFS-7866.7.patch, HDFS-7866.8.patch, HDFS-7866.9.patch
>
>
> This is to extend NameNode to load, list and sync predefine EC schemas in 
> authorized and controlled approach. The provided facilities will be used to 
> implement DFSAdmin commands so admin can list available EC schemas, then 
> could choose some of them for target EC zones.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to