hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject hbase git commit: HBASE-12664 TestDefaultLoadBalancer.testBalanceCluster fails in CachedDNSToSwitchMapping
Date Tue, 09 Dec 2014 19:15:14 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 9a128b94d -> d7f2ac796


HBASE-12664 TestDefaultLoadBalancer.testBalanceCluster fails in CachedDNSToSwitchMapping

Conflicts:
	hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestDefaultLoadBalancer.java
	hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStochasticLoadBalancer.java


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

Branch: refs/heads/branch-1
Commit: d7f2ac796f223881b4d112f634701ea8977866d3
Parents: 9a128b9
Author: stack <stack@apache.org>
Authored: Tue Dec 9 11:06:23 2014 -0800
Committer: stack <stack@apache.org>
Committed: Tue Dec 9 11:15:01 2014 -0800

----------------------------------------------------------------------
 .../hbase/master/balancer/BalancerTestBase.java | 24 ++++++++++++++++++++
 .../master/balancer/TestBaseLoadBalancer.java   | 24 --------------------
 .../balancer/TestDefaultLoadBalancer.java       |  1 +
 .../balancer/TestStochasticLoadBalancer.java    |  4 ++++
 4 files changed, 29 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/d7f2ac79/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/BalancerTestBase.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/BalancerTestBase.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/BalancerTestBase.java
index 7635ffa..260a8e9 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/BalancerTestBase.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/BalancerTestBase.java
@@ -33,6 +33,7 @@ import java.util.SortedSet;
 import java.util.TreeMap;
 import java.util.TreeSet;
 
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
@@ -40,6 +41,7 @@ import org.apache.hadoop.hbase.client.RegionReplicaUtil;
 import org.apache.hadoop.hbase.master.RackManager;
 import org.apache.hadoop.hbase.master.RegionPlan;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.net.DNSToSwitchMapping;
 import org.junit.Assert;
 
 /**
@@ -53,6 +55,28 @@ public class BalancerTestBase {
   protected static Random rand = new Random();
   static int regionId = 0;
 
+  // This class is introduced because IP to rack resolution can be lengthy.
+  static class MockMapping implements DNSToSwitchMapping {
+    public MockMapping(Configuration conf) {
+    }
+
+    public List<String> resolve(List<String> names) {
+      List<String> ret = new ArrayList<String>(names.size());
+      for (String name : names) {
+        ret.add("rack");
+      }
+      return ret;
+    }
+
+    // do not add @Override annotations here. It mighty break compilation with earlier Hadoops
+    public void reloadCachedMappings() {
+    }
+
+    // do not add @Override annotations here. It mighty break compilation with earlier Hadoops
+    public void reloadCachedMappings(List<String> arg0) {
+    }
+  }
+
   /**
    * Invariant is that all servers have between floor(avg) and ceiling(avg)
    * number of regions.

http://git-wip-us.apache.org/repos/asf/hbase/blob/d7f2ac79/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 68ee4b7..3bdae33 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
@@ -72,30 +72,6 @@ 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 implements DNSToSwitchMapping {
-    public MockMapping(Configuration conf) {
-    }
-
-    private static String RACK = "rack";
-
-    public List<String> resolve(List<String> names) {
-      List<String> ret = new ArrayList<String>(names.size());
-      for (String name : names) {
-        ret.add(RACK);
-      }
-      return ret;
-    }
-
-    // do not add @Override annotations here. It mighty break compilation with earlier Hadoops
-    public void reloadCachedMappings() {
-    }
-
-    // do not add @Override annotations here. It mighty break compilation with earlier Hadoops
-    public void reloadCachedMappings(List<String> arg0) {
-    }
-  }
-
   @BeforeClass
   public static void beforeAllTests() throws Exception {
     Configuration conf = HBaseConfiguration.create();

http://git-wip-us.apache.org/repos/asf/hbase/blob/d7f2ac79/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestDefaultLoadBalancer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestDefaultLoadBalancer.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestDefaultLoadBalancer.java
index 5468abe..03e4b84 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestDefaultLoadBalancer.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestDefaultLoadBalancer.java
@@ -45,6 +45,7 @@ public class TestDefaultLoadBalancer extends BalancerTestBase {
   @BeforeClass
   public static void beforeAllTests() throws Exception {
     Configuration conf = HBaseConfiguration.create();
+    conf.setClass("hbase.util.ip.to.rack.determiner", MockMapping.class, DNSToSwitchMapping.class);
     conf.set("hbase.regions.slop", "0");
     loadBalancer = new SimpleLoadBalancer();
     loadBalancer.setConf(conf);

http://git-wip-us.apache.org/repos/asf/hbase/blob/d7f2ac79/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStochasticLoadBalancer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStochasticLoadBalancer.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStochasticLoadBalancer.java
index b3d6e39..ffbf0fe 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStochasticLoadBalancer.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStochasticLoadBalancer.java
@@ -48,7 +48,10 @@ import org.apache.hadoop.hbase.client.RegionReplicaUtil;
 import org.apache.hadoop.hbase.master.RackManager;
 import org.apache.hadoop.hbase.master.RegionPlan;
 import org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer.Cluster;
+import org.apache.hadoop.hbase.testclassification.FlakeyTests;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.net.DNSToSwitchMapping;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -63,6 +66,7 @@ public class TestStochasticLoadBalancer extends BalancerTestBase {
   @BeforeClass
   public static void beforeAllTests() throws Exception {
     conf = HBaseConfiguration.create();
+    conf.setClass("hbase.util.ip.to.rack.determiner", MockMapping.class, DNSToSwitchMapping.class);
     conf.setFloat("hbase.master.balancer.stochastic.maxMovePercent", 0.75f);
     conf.setFloat("hbase.regions.slop", 0.0f);
     loadBalancer = new StochasticLoadBalancer();


Mime
View raw message