hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesse Yates (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-4448) HBaseTestingUtilityFactory - pattern for re-using HBaseTestingUtility instances across unit tests
Date Tue, 27 Sep 2011 19:07:46 GMT

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

Jesse Yates commented on HBASE-4448:
------------------------------------

Comments on the latest patch:

In the usage, 
{code}
-  private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
+  private static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
{code}

Should probably not even assign anything, since it is done in setup.

Going back to Ted's comment,
{code}
 Integer i = mcUsageCount.get(tu);  
+    if (i == null) {
+      i = ONE;
+    } else {
+      int j = i.intValue() + 1;
+      i = new Integer(j);
+    }
+    mcUsageCount.put(tu, i);
+  }
{code}

This seems overly complex - just use autoboxing here. Maybe we should use specific names for
what ONE and ZERO mean (e.g. ONE -> USE_INCREMENT, ZERO -> UNUSED).

In the UtilityCleaner,
{code}
+     try {
+        while (true) {
{code}

could lead to some issues. We just need to make sure that the thread is a daemon thread when
we start.

                
> 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

        

Mime
View raw message