hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-12554 TestBaseLoadBalancer may timeout due to lengthy rack lookup
Date Sat, 22 Nov 2014 00:52:20 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 882324dbc -> 7ee4df600


HBASE-12554 TestBaseLoadBalancer may timeout due to lengthy rack lookup


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7ee4df60
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7ee4df60
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7ee4df60

Branch: refs/heads/master
Commit: 7ee4df600bb7ec8d794dd3b4ab2cb933ab15b988
Parents: 882324d
Author: tedyu <yuzhihong@gmail.com>
Authored: Fri Nov 21 16:52:11 2014 -0800
Committer: tedyu <yuzhihong@gmail.com>
Committed: Fri Nov 21 16:52:11 2014 -0800

----------------------------------------------------------------------
 .../master/balancer/TestBaseLoadBalancer.java    | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/7ee4df60/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestBaseLoadBalancer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestBaseLoadBalancer.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestBaseLoadBalancer.java
index 11ca6c7..73ae11e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestBaseLoadBalancer.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestBaseLoadBalancer.java
@@ -50,6 +50,8 @@ import org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer.Cluster;
 import org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer.Cluster.MoveRegionAction;
 import org.apache.hadoop.hbase.testclassification.MasterTests;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.net.DNSToSwitchMapping;
+import org.apache.hadoop.net.ScriptBasedMapping;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -74,9 +76,26 @@ public class TestBaseLoadBalancer extends BalancerTestBase {
       new int[] { 1, 3 }, new int[] { 2, 3 }, new int[] { 3, 3 }, new int[] { 25, 3 },
       new int[] { 2, 10 }, new int[] { 2, 100 }, new int[] { 12, 10 }, new int[] { 12, 100
}, };
 
+  // This class is introduced because IP to rack resolution can be lengthy.
+  public static class MockMapping extends ScriptBasedMapping {
+    public MockMapping(Configuration conf) {
+    }
+
+    private static String RACK = "rack";
+    @Override
+    public List<String> resolve(List<String> names) {
+      List<String> ret = new ArrayList<String>(names.size());
+      for (String name : names) {
+        ret.add(RACK);
+      }
+      return ret;
+    }
+  }
+
   @BeforeClass
   public static void beforeAllTests() throws Exception {
     Configuration conf = HBaseConfiguration.create();
+    conf.setClass("hbase.util.ip.to.rack.determiner", MockMapping.class, DNSToSwitchMapping.class);
     loadBalancer = new MockBalancer();
     loadBalancer.setConf(conf);
     MasterServices st = Mockito.mock(MasterServices.class);


Mime
View raw message