[
https://issues.apache.org/jira/browse/HBASE-21071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16584586#comment-16584586
]
Mingliang Liu commented on HBASE-21071:
---------------------------------------
Thanks [[email protected]] and [~stack] for positive feedback.
Yes, the existing structure is not very well organized as we have multiple
{{MiniHBaseCluster}} constructors accepting different combination of arguments,
13 {{startMiniCluster()}} methods, and 3 {{startMiniHBaseCluster()}}; plus
{{startMiniCluster()}} ultimately calls {{startMiniHBaseCluster()}} after
building {{MiniDFSCluster}} and {{MiniZKCluster}}.
{quote}
Does this mean the options should be MiniHBaseClusterOptions and we should
rename this start method to be startMiniHBaseCluster.
{quote}
My previous idea was to have both DFS cluster options ({{numDataNodes}} and
{{dataNodeHosts}}) and HBase cluster options as most tests create them together
via {{startMiniCluster()}}. I also see usages where only DFSCluster was created
so I think HBase cluster (option) builder also makes sense here.
{quote}
Would a MiniHBaseClusterBuilder make sense returning a MiniHBaseCluster
instance on which you called start.
{quote}
I like this idea. Let me provide an early patch to show how the structure can
be clearer. I will work on {{master}} branch first as I don't worry about
pruning old stuff.
> 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
>
> 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)