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

Mingliang Liu commented on HBASE-21071:
---------------------------------------

Thanks [~stack] for prompt review and helpful comments!

Yes it's necessary to make javadoc clear. In the v1 patch I put comments for 
each {{StartMiniClusterOption}} field so I did not put anything for the 
Builder. I agree that the field name should be meaningful. I also got confused 
about the {{create}} and {{withWALDir}} options, so I read through and rename 
them to {{createRootDir}} and {{createWALDir}} respectively. The v2 patch also 
refined the comments for those two options in  {{StartMiniClusterOption}}  
javadoc.

I leave the extra short cut method to start a mini cluster: 
{{startMiniCluster(int numSlaves)}}. There are >300 usages in the whole project 
and this method needs special attention. The other start method 
{{startMiniCluster(int numMasters, int numSlaves)}} was deleted as there are 
only ~20 effective use cases and I changed them manually from v1 patch to v2.

If the v2 patch looks good, I'll prepare for a branch-2 one.

> HBaseTestingUtility::startMiniCluster() to use builder pattern
> --------------------------------------------------------------
>
>                 Key: HBASE-21071
>                 URL: https://issues.apache.org/jira/browse/HBASE-21071
>             Project: HBase
>          Issue Type: Bug
>          Components: test
>    Affects Versions: 3.0.0
>            Reporter: Mingliang Liu
>            Assignee: Mingliang Liu
>            Priority: Major
>         Attachments: HBASE-21071.000.patch, HBASE-21071.001.patch, 
> HBASE-21071.002.patch
>
>
> Currently there are 13 {{startMiniCluster()}} methods to set up a mini 
> cluster. I'm not surprised if we have a few more in future. It's good to 
> support different combination of optional parameters. We have to pick up one 
> of them carefully while still wondering the default values of other 
> parameters; if we add a new option, we may bring more new methods.
> One solution is to use builder pattern: create a class {{MiniClusterOptions}} 
> along with a static class {{MiniClusterOptionsBuilder}}, create a new method  
> {{startMiniCluster(MiniClusterOptions)}}. In {{master}} we delete the old 13 
> methods while in branch-2, we deprecate the old 13 methods.
> Thoughts?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to