[ https://issues.apache.org/jira/browse/HBASE-4448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13118850#comment-13118850 ]
Doug Meil commented on HBASE-4448: ---------------------------------- Thanks Stack. re: "Reusing the cluster also implies each test cleans up after itself." This is the situation now, though. Test-classes do this cluster teardown in the @AfterClass annotation by tearing down the cluster. The factory does all the table-cleanup when the cluster is returned. Calling 'cluster.shutdown' and returning the cluster to the factory is the same amount of code (1 line). When tests run in parallel, are we talking Test-classes, or test-methods? It's the former, right? And would these be in separate JVMs? If so, I think we're ok. If there are a pool of JVMs that get used throughout a build then this can work. If they are getting setup and torn down then it won't. By the way, I think this is exactly the right level of conversation to have on this issue (i.e., not detail code-level, but the larger build issues). I'd still like to lobby for something like this because unless cluster-startup and teardown can be amazingly fast, we're leaving 10-15 minutes on the floor easy every time we run the build - and that's just for the common cluster configs. > HBaseTestingUtilityFactory - pattern for re-using HBaseTestingUtility > instances across unit tests > ------------------------------------------------------------------------------------------------- > > Key: HBASE-4448 > URL: https://issues.apache.org/jira/browse/HBASE-4448 > Project: HBase > Issue Type: Improvement > Reporter: Doug Meil > Assignee: Doug Meil > Priority: Minor > Attachments: HBaseTestingUtilityFactory.java, > hbase_hbaseTestingUtility_uses_2011_09_22.xlsx, java_HBASE_4448.patch, > java_HBASE_4448_v2.patch > > > Setting up and tearing down HBaseTestingUtility instances in unit tests is > very expensive. On my MacBook it takes about 10 seconds to set up a > MiniCluster, and 7 seconds to tear it down. When multiplied by the number of > test classes that use this facility, that's a lot of time in the build. > This factory assumes that the JVM is being re-used across test classes in the > build, otherwise this pattern won't work. > I don't think this is appropriate for every use, but I think it can be > applicable in a great many cases - especially where developers just want a > simple MiniCluster with 1 slave. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira