hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Wang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-11170) Add create API in filesystem public class to support assign parameter through builder
Date Fri, 24 Mar 2017 00:00:44 GMT

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

Andrew Wang commented on HDFS-11170:

Hi Sammi, thanks for the rev!

bq. The reason I think is that leave the setDefaultValue right before the create call to save
the unnecessary default value assignment if API caller will call the specific setter to set
the value.

I don't think this causes any additional assignment, since the getters are only called once
(at {{build}} time), and inline the same if statements as what's in {{setDefaultValue}}. My
sample code looked like this:

  protected int getBufferSize() {
    if (bufferSize == null) {
      return fs.getConf().getInt(IO_FILE_BUFFER_SIZE_KEY,
    return bufferSize;

Returning directly might also be a bit more efficient by not calling the setter (current setDefaultValue

bq. From the point that unit tests as example code, would it be better to keep a distinct
test function, so user can easily find it by refer to the function name? Also, I went through
the test function name list of TestDistributedFileSystem, all function name carries their
target clearly.

Sure, it's okay to leave it as is. I agree that this is easier to find and a good standalone

> 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,
HDFS-11170-04.patch, HDFS-11170-05.patch, HDFS-11170-06.patch, HDFS-11170-07.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

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

View raw message