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

Andrew Wang commented on HDFS-11170:
------------------------------------

Hi Sammi, thanks for taking this over, a few review comments:

General:
* Can we make the new DFS create method private rather than public?
* Canonically, the builder pattern's {{build}} pattern normally returns an 
immutable argument with just getters. Maybe call this object 
{{CreateParameters}}?

Error checking in {{build}}:

We should also try to do fill in defaults similar to how FileSystem currently 
works. For example:

* {{build}} fills in some defaults like {{OVERWRITE}} and the replication and 
block size, but when I trace through the {{create}} overloads, it doesn't go 
all the way. We're missing the default permission and umask. Could you check 
for anything else?
* We also need to be careful to differentiate between a set {{0}} and the value 
not being set for things like replication and block size. I think we can do 
this by internally using the nullable numeric types like {{Long}} and {{Short}}.
* The builder API setters though should still use the primitive types like 
normal create calls. Need to also fix {{setReplication}} which takes a 
{{Short}} rather than a {{short}} currently.

[~stack] do you mind taking a quick look at the API? There are some examples in 
the test cases. I'm hoping this can help clean up the HBase-side code that does 
favored nodes.

> Add create API in filesystem public class to support assign parameter through 
> builder
> -------------------------------------------------------------------------------------
>
>                 Key: HDFS-11170
>                 URL: https://issues.apache.org/jira/browse/HDFS-11170
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>            Reporter: SammiChen
>            Assignee: Wei Zhou
>              Labels: hdfs-ec-3.0-nice-to-have
>         Attachments: HDFS-11170-00.patch, HDFS-11170-01.patch, 
> HDFS-11170-02.patch, HDFS-11170-03.patch
>
>
> FileSystem class supports multiple create functions to help user create file. 
> Some create functions has many parameters, it's hard for user to exactly 
> remember these parameters and their orders. This task is to add builder  
> based create functions to help user more easily create file. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to