[ 
https://issues.apache.org/jira/browse/HADOOP-4764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12653666#action_12653666
 ] 

Ruyue Ma commented on HADOOP-4764:
----------------------------------

We doesn't need modify the FSImage, we only modify the FSEditLog. 

Current FSImage sets 0 to the default replication factor for directory.

The modification for FSEditLog doesn't affect the compatible with old log 
format.

the original code in FSEditLog

  /** 
   * Add create directory record to edit log
   */
  public void logMkDir(String path, INode newNode) {
    UTF8 info[] = new UTF8[] {
      new UTF8(path),
      FSEditLog.toLogLong(newNode.getModificationTime()),
      FSEditLog.toLogLong(newNode.getAccessTime())
    };
    logEdit(OP_MKDIR, new ArrayWritable(UTF8.class, info),
        newNode.getPermissionStatus());
  }

is modified to the following:

  /** 
   * Add create directory record to edit log
   */
  public void logMkDir(String path, INode newNode) {
    UTF8 info[] = new UTF8[] {
      new UTF8(path),
      FSEditLog.toLogReplication(newNode.getReplication()),
      FSEditLog.toLogLong(newNode.getModificationTime()),
      FSEditLog.toLogLong(newNode.getAccessTime())
    };
    logEdit(OP_MKDIR, new ArrayWritable(UTF8.class, info),
        newNode.getPermissionStatus());
  }

> add replication factor for hdfs directory
> -----------------------------------------
>
>                 Key: HADOOP-4764
>                 URL: https://issues.apache.org/jira/browse/HADOOP-4764
>             Project: Hadoop Core
>          Issue Type: New Feature
>          Components: dfs
>            Reporter: Ruyue Ma
>            Assignee: Ruyue Ma
>
> If we can set replication factor for directory. we can modify the 
> DFSClent.create() method, pass 0 for the default block replication. Namenode 
> check create request, if blockreplication is 0, it will give its parent dir 
> replication factor to the file blockreplication factor. This will simplify 
> the administration work. You know we can set /Test or /Tmp dir's replication 
> factor 2 or 1, then all their children files and dirs replication factor is 2 
> or 1 defaultly.
>    

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to