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-18575 [AMv2] Fixed and enabled TestRestartCluster#testRetainAssignmentOnRestart on master
Date Wed, 23 Aug 2017 17:11:05 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 2dda37120 -> 6b21f8881


HBASE-18575 [AMv2] Fixed and enabled TestRestartCluster#testRetainAssignmentOnRestart on master

* Fixed ServerCrashProcedure to set forceNewPlan to false for instances AssignProcedure. This
enables balancer to find most suitable target server
* Fixed and enabled TestRestartCluster#testRetainAssignmentOnRestart on master
* Renamed method ServerName@isSameHostnameAndPort() to isSameAddress()

Signed-off-by: Michael Stack <stack@apache.org>


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

Branch: refs/heads/master
Commit: 6b21f8881be7649dadbdecd28dc2e2abe5c4ebe5
Parents: 2dda371
Author: Umesh Agashe <uagashe@cloudera.com>
Authored: Tue Aug 22 16:23:21 2017 -0700
Committer: Michael Stack <stack@apache.org>
Committed: Wed Aug 23 10:10:56 2017 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/hadoop/hbase/ServerName.java |  4 ++--
 .../apache/hadoop/hbase/DistributedHBaseCluster.java  |  4 ++--
 .../master/balancer/TestRSGroupBasedLoadBalancer.java |  2 +-
 .../hbase/favored/FavoredNodeAssignmentHelper.java    |  3 +--
 .../hadoop/hbase/favored/FavoredNodeLoadBalancer.java |  2 +-
 .../apache/hadoop/hbase/favored/FavoredNodesPlan.java |  2 +-
 .../hadoop/hbase/master/ActiveMasterManager.java      |  2 +-
 .../org/apache/hadoop/hbase/master/DeadServer.java    |  4 ++--
 .../org/apache/hadoop/hbase/master/ServerManager.java |  3 +--
 .../master/balancer/FavoredStochasticBalancer.java    |  4 ++--
 .../hbase/master/procedure/ServerCrashProcedure.java  |  4 +++-
 .../hadoop/hbase/regionserver/HRegionServer.java      |  3 +--
 .../java/org/apache/hadoop/hbase/TestServerName.java  |  2 +-
 .../favored/TestStartcodeAgnosticServerName.java      |  4 ++--
 .../hadoop/hbase/master/TestRegionPlacement.java      |  8 ++++----
 .../hadoop/hbase/master/TestRegionPlacement2.java     | 14 +++++++-------
 .../hadoop/hbase/master/TestRestartCluster.java       |  7 ++++---
 .../TestFavoredStochasticBalancerPickers.java         |  4 ++--
 .../balancer/TestFavoredStochasticLoadBalancer.java   |  7 +++----
 19 files changed, 41 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-common/src/main/java/org/apache/hadoop/hbase/ServerName.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/ServerName.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/ServerName.java
index 88abc3f..5f83782 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/ServerName.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/ServerName.java
@@ -347,8 +347,8 @@ public class ServerName implements Comparable<ServerName>, Serializable
{
    * @param right
    * @return True if <code>other</code> has same hostname and port.
    */
-  public static boolean isSameHostnameAndPort(final ServerName left,
-      final ServerName right) {
+  public static boolean isSameAddress(final ServerName left,
+                                      final ServerName right) {
     // TODO: Make this left.getAddress().equals(right.getAddress())
     if (left == null) return false;
     if (right == null) return false;

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
index 431ba42..55c6e28 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/DistributedHBaseCluster.java
@@ -320,7 +320,7 @@ public class DistributedHBaseCluster extends HBaseCluster {
     List<IOException> deferred = new ArrayList<>();
     //check whether current master has changed
     final ServerName initMaster = initial.getMaster();
-    if (!ServerName.isSameHostnameAndPort(initMaster, current.getMaster())) {
+    if (!ServerName.isSameAddress(initMaster, current.getMaster())) {
       LOG.info("Restoring cluster - Initial active master : "
               + initMaster.getHostAndPort()
               + " has changed to : "
@@ -340,7 +340,7 @@ public class DistributedHBaseCluster extends HBaseCluster {
         // 2. Stop current master
         // 3. Start backup masters
         for (ServerName currentBackup : current.getBackupMasters()) {
-          if (!ServerName.isSameHostnameAndPort(currentBackup, initMaster)) {
+          if (!ServerName.isSameAddress(currentBackup, initMaster)) {
             LOG.info("Restoring cluster - stopping backup master: " + currentBackup);
             stopMaster(currentBackup);
           }

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRSGroupBasedLoadBalancer.java
----------------------------------------------------------------------
diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRSGroupBasedLoadBalancer.java
b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRSGroupBasedLoadBalancer.java
index fa170fe..488afdf 100644
--- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRSGroupBasedLoadBalancer.java
+++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRSGroupBasedLoadBalancer.java
@@ -420,7 +420,7 @@ public class TestRSGroupBasedLoadBalancer {
       ServerAndLoad newSAL = null;
       ServerAndLoad oldSAL = null;
       for (ServerAndLoad sal : previousLoad.get(groupName)) {
-        if (ServerName.isSameHostnameAndPort(sn, sal.getServerName())) {
+        if (ServerName.isSameAddress(sn, sal.getServerName())) {
           oldSAL = sal;
           newSAL = new ServerAndLoad(sn, sal.getLoad() + diff);
           break;

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodeAssignmentHelper.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodeAssignmentHelper.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodeAssignmentHelper.java
index f20c876..c001010 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodeAssignmentHelper.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodeAssignmentHelper.java
@@ -31,7 +31,6 @@ import java.util.Map.Entry;
 import java.util.Random;
 import java.util.Set;
 
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Maps;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -105,7 +104,7 @@ public class FavoredNodeAssignmentHelper {
         this.rackToRegionServerMap.put(rackName, serverList);
       }
       for (ServerName serverName : serverList) {
-        if (ServerName.isSameHostnameAndPort(sn, serverName)) {
+        if (ServerName.isSameAddress(sn, serverName)) {
           // The server is already present, ignore.
           break;
         }

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodeLoadBalancer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodeLoadBalancer.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodeLoadBalancer.java
index 8b57ce6..680a902 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodeLoadBalancer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodeLoadBalancer.java
@@ -278,7 +278,7 @@ public class FavoredNodeLoadBalancer extends BaseLoadBalancer implements
Favored
   // server with the legit startcode
   private ServerName availableServersContains(List<ServerName> servers, ServerName
favoredNode) {
     for (ServerName server : servers) {
-      if (ServerName.isSameHostnameAndPort(favoredNode, server)) {
+      if (ServerName.isSameAddress(favoredNode, server)) {
         return server;
       }
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodesPlan.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodesPlan.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodesPlan.java
index ff6d9e1..0f91cc8 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodesPlan.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/favored/FavoredNodesPlan.java
@@ -92,7 +92,7 @@ public class FavoredNodesPlan {
       return null;
     }
     for (Position p : Position.values()) {
-      if (ServerName.isSameHostnameAndPort(favoredNodes.get(p.ordinal()),server)) {
+      if (ServerName.isSameAddress(favoredNodes.get(p.ordinal()),server)) {
         return p;
       }
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java
index 0466e98..d063452 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java
@@ -200,7 +200,7 @@ public class ActiveMasterManager extends ZooKeeperListener {
             // Hopefully next time around we won't fail the parse.  Dangerous.
             continue;
           }
-          if (ServerName.isSameHostnameAndPort(currentMaster, this.sn)) {
+          if (ServerName.isSameAddress(currentMaster, this.sn)) {
             msg = ("Current master has this master's address, " +
               currentMaster + "; master was restarted? Deleting node.");
             // Hurry along the expiration of the znode.

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DeadServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DeadServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DeadServer.java
index c394424..fc86254 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DeadServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DeadServer.java
@@ -75,7 +75,7 @@ public class DeadServer {
     Iterator<ServerName> it = deadServers.keySet().iterator();
     while (it.hasNext()) {
       ServerName sn = it.next();
-      if (ServerName.isSameHostnameAndPort(sn, newServerName)) {
+      if (ServerName.isSameAddress(sn, newServerName)) {
         it.remove();
         return true;
       }
@@ -149,7 +149,7 @@ public class DeadServer {
     Iterator<ServerName> it = deadServers.keySet().iterator();
     while (it.hasNext()) {
       ServerName sn = it.next();
-      if (ServerName.isSameHostnameAndPort(sn, newServerName)) {
+      if (ServerName.isSameAddress(sn, newServerName)) {
         it.remove();
       }
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
index 86177b8..23160c1 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
@@ -55,7 +55,6 @@ import org.apache.hadoop.hbase.client.ClusterConnection;
 import org.apache.hadoop.hbase.client.RetriesExhaustedException;
 import org.apache.hadoop.hbase.ipc.HBaseRpcController;
 import org.apache.hadoop.hbase.ipc.RpcControllerFactory;
-import org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer;
 import org.apache.hadoop.hbase.monitoring.MonitoredTask;
 import org.apache.hadoop.hbase.regionserver.HRegionServer;
 import org.apache.hadoop.hbase.shaded.com.google.protobuf.UnsafeByteOperations;
@@ -414,7 +413,7 @@ public class ServerManager {
 
     ServerName r = onlineServers.lowerKey(end);
     if (r != null) {
-      if (ServerName.isSameHostnameAndPort(r, serverName)) {
+      if (ServerName.isSameAddress(r, serverName)) {
         return r;
       }
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/FavoredStochasticBalancer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/FavoredStochasticBalancer.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/FavoredStochasticBalancer.java
index 86ccd47..8dc2a85 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/FavoredStochasticBalancer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/FavoredStochasticBalancer.java
@@ -252,7 +252,7 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer
implements
    */
   private ServerName getServerFromFavoredNode(List<ServerName> servers, ServerName
fn) {
     for (ServerName server : servers) {
-      if (ServerName.isSameHostnameAndPort(fn, server)) {
+      if (ServerName.isSameAddress(fn, server)) {
         return server;
       }
     }
@@ -463,7 +463,7 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer
implements
       List<ServerName> result = Lists.newArrayList();
       for (ServerName sn : serversWithoutStartCodes) {
         for (ServerName online : onlineServers) {
-          if (ServerName.isSameHostnameAndPort(sn, online)) {
+          if (ServerName.isSameAddress(sn, online)) {
             result.add(online);
           }
         }

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ServerCrashProcedure.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ServerCrashProcedure.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ServerCrashProcedure.java
index 4370a8c..c7af53f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ServerCrashProcedure.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ServerCrashProcedure.java
@@ -164,8 +164,10 @@ implements ServerProcedureInterface {
           }
           handleRIT(env, regionsOnCrashedServer);
           AssignmentManager am = env.getAssignmentManager();
+          // forceNewPlan is set to false. Balancer is expected to find most suitable target
+          // server if retention is not possible.
           addChildProcedure(am.
-              createAssignProcedures(am.getOrderedRegions(regionsOnCrashedServer), true));
+              createAssignProcedures(am.getOrderedRegions(regionsOnCrashedServer), false));
         }
         setNextState(ServerCrashState.SERVER_CRASH_FINISH);
         break;

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
index 0c1814f..28b7a43 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
@@ -118,7 +118,6 @@ import org.apache.hadoop.hbase.ipc.ServerRpcController;
 import org.apache.hadoop.hbase.master.HMaster;
 import org.apache.hadoop.hbase.master.LoadBalancer;
 import org.apache.hadoop.hbase.master.RegionState.State;
-import org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer;
 import org.apache.hadoop.hbase.mob.MobCacheConfig;
 import org.apache.hadoop.hbase.procedure.RegionServerProcedureManagerHost;
 import org.apache.hadoop.hbase.quotas.FileSystemUtilizationChore;
@@ -3406,7 +3405,7 @@ public class HRegionServer extends HasThread implements
   private static final int TIMEOUT_REGION_MOVED = (2 * 60 * 1000);
 
   protected void addToMovedRegions(String encodedName, ServerName destination, long closeSeqNum)
{
-    if (ServerName.isSameHostnameAndPort(destination, this.getServerName())) {
+    if (ServerName.isSameAddress(destination, this.getServerName())) {
       LOG.warn("Not adding moved region record: " + encodedName + " to self.");
       return;
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-server/src/test/java/org/apache/hadoop/hbase/TestServerName.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestServerName.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestServerName.java
index d1b2145..c1b5dac 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestServerName.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestServerName.java
@@ -108,7 +108,7 @@ public class TestServerName {
     assertEquals(lower.hashCode(), upper.hashCode());
     assertTrue(lower.equals(upper));
     assertTrue(upper.equals(lower));
-    assertTrue(ServerName.isSameHostnameAndPort(lower, upper));
+    assertTrue(ServerName.isSameAddress(lower, upper));
   }
 }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-server/src/test/java/org/apache/hadoop/hbase/favored/TestStartcodeAgnosticServerName.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/favored/TestStartcodeAgnosticServerName.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/favored/TestStartcodeAgnosticServerName.java
index 6e9f19c..50a02a1 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/favored/TestStartcodeAgnosticServerName.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/favored/TestStartcodeAgnosticServerName.java
@@ -35,14 +35,14 @@ public class TestStartcodeAgnosticServerName {
     StartcodeAgnosticServerName snStartCode =
         new StartcodeAgnosticServerName("www.example.org", 1234, 5678);
 
-    assertTrue(ServerName.isSameHostnameAndPort(sn, snStartCode));
+    assertTrue(ServerName.isSameAddress(sn, snStartCode));
     assertTrue(snStartCode.equals(sn));
     assertTrue(sn.equals(snStartCode));
     assertEquals(0, snStartCode.compareTo(sn));
 
     StartcodeAgnosticServerName snStartCodeFNPort =
         new StartcodeAgnosticServerName("www.example.org", 1234, ServerName.NON_STARTCODE);
-    assertTrue(ServerName.isSameHostnameAndPort(snStartCodeFNPort, snStartCode));
+    assertTrue(ServerName.isSameAddress(snStartCodeFNPort, snStartCode));
     assertTrue(snStartCode.equals(snStartCodeFNPort));
     assertTrue(snStartCodeFNPort.equals(snStartCode));
     assertEquals(0, snStartCode.compareTo(snStartCodeFNPort));

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionPlacement.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionPlacement.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionPlacement.java
index b3859ff..ccc5b17 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionPlacement.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionPlacement.java
@@ -201,14 +201,14 @@ public class TestRegionPlacement {
           break;
         }
       }
-    } while (ServerName.isSameHostnameAndPort(metaServer, serverToKill) || isNamespaceServer
||
+    } while (ServerName.isSameAddress(metaServer, serverToKill) || isNamespaceServer ||
         TEST_UTIL.getHBaseCluster().getRegionServer(killIndex).getNumberOfOnlineRegions()
== 0);
     LOG.debug("Stopping RS " + serverToKill);
     Map<HRegionInfo, Pair<ServerName, ServerName>> regionsToVerify = new HashMap<>();
     // mark the regions to track
     for (Map.Entry<HRegionInfo, ServerName[]> entry : favoredNodesAssignmentPlan.entrySet())
{
       ServerName s = entry.getValue()[0];
-      if (ServerName.isSameHostnameAndPort(s, serverToKill)) {
+      if (ServerName.isSameAddress(s, serverToKill)) {
         regionsToVerify.put(entry.getKey(), new Pair<>(entry.getValue()[1], entry.getValue()[2]));
         LOG.debug("Adding " + entry.getKey() + " with sedcondary/tertiary " +
             entry.getValue()[1] + " " + entry.getValue()[2]);
@@ -232,8 +232,8 @@ public class TestRegionPlacement {
       LOG.debug("New destination for region " + entry.getKey().getEncodedName() +
           " " + newDestination +". Secondary/Tertiary are " + secondaryTertiaryServers.getFirst()
           + "/" + secondaryTertiaryServers.getSecond());
-      if (!(ServerName.isSameHostnameAndPort(newDestination, secondaryTertiaryServers.getFirst())||
-          ServerName.isSameHostnameAndPort(newDestination, secondaryTertiaryServers.getSecond()))){
+      if (!(ServerName.isSameAddress(newDestination, secondaryTertiaryServers.getFirst())||
+          ServerName.isSameAddress(newDestination, secondaryTertiaryServers.getSecond()))){
         fail("Region " + entry.getKey() + " not present on any of the expected servers");
       }
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionPlacement2.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionPlacement2.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionPlacement2.java
index f10c368..86aca40 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionPlacement2.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionPlacement2.java
@@ -94,7 +94,7 @@ public class TestRegionPlacement2 {
         ((FavoredNodeLoadBalancer)balancer).getFavoredNodes(region);
     assertTrue(favoredNodesBefore.size() == FavoredNodeAssignmentHelper.FAVORED_NODES_NUM);
     // the primary RS should be the one that the balancer's assignment returns
-    assertTrue(ServerName.isSameHostnameAndPort(serverBefore.iterator().next(),
+    assertTrue(ServerName.isSameAddress(serverBefore.iterator().next(),
         favoredNodesBefore.get(PRIMARY)));
     // now remove the primary from the list of available servers
     List<ServerName> removedServers = removeMatchingServers(serverBefore, servers);
@@ -110,9 +110,9 @@ public class TestRegionPlacement2 {
     Set<ServerName> serverAfter = assignmentMap.keySet();
     // We expect the new RegionServer assignee to be one of the favored nodes
     // chosen earlier.
-    assertTrue(ServerName.isSameHostnameAndPort(serverAfter.iterator().next(),
+    assertTrue(ServerName.isSameAddress(serverAfter.iterator().next(),
                  favoredNodesBefore.get(SECONDARY)) ||
-               ServerName.isSameHostnameAndPort(serverAfter.iterator().next(),
+               ServerName.isSameAddress(serverAfter.iterator().next(),
                  favoredNodesBefore.get(TERTIARY)));
 
     // put back the primary in the list of available servers
@@ -153,7 +153,7 @@ public class TestRegionPlacement2 {
         ((FavoredNodeLoadBalancer)balancer).getFavoredNodes(region);
     assertTrue(favoredNodesBefore.size() == FavoredNodeAssignmentHelper.FAVORED_NODES_NUM);
     // the primary RS should be the one that the balancer's assignment returns
-    assertTrue(ServerName.isSameHostnameAndPort(serverBefore,favoredNodesBefore.get(PRIMARY)));
+    assertTrue(ServerName.isSameAddress(serverBefore,favoredNodesBefore.get(PRIMARY)));
     // now remove the primary from the list of servers
     removeMatchingServers(serverBefore, servers);
     // call randomAssignment with the modified servers list
@@ -167,8 +167,8 @@ public class TestRegionPlacement2 {
     assertTrue(favoredNodesAfter.containsAll(favoredNodesBefore));
     // We expect the new RegionServer assignee to be one of the favored nodes
     // chosen earlier.
-    assertTrue(ServerName.isSameHostnameAndPort(serverAfter, favoredNodesBefore.get(SECONDARY))
||
-               ServerName.isSameHostnameAndPort(serverAfter, favoredNodesBefore.get(TERTIARY)));
+    assertTrue(ServerName.isSameAddress(serverAfter, favoredNodesBefore.get(SECONDARY)) ||
+               ServerName.isSameAddress(serverAfter, favoredNodesBefore.get(TERTIARY)));
     // Make all the favored nodes unavailable for assignment
     removeMatchingServers(favoredNodesAfter, servers);
     // call randomAssignment with the modified servers list
@@ -194,7 +194,7 @@ public class TestRegionPlacement2 {
       List<ServerName> servers) {
     List<ServerName> serversToRemove = new ArrayList<>();
     for (ServerName s : servers) {
-      if (ServerName.isSameHostnameAndPort(s, serverWithoutStartCode)) {
+      if (ServerName.isSameAddress(s, serverWithoutStartCode)) {
         serversToRemove.add(s);
       }
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRestartCluster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRestartCluster.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRestartCluster.java
index 351fca4..4eb4e53 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRestartCluster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRestartCluster.java
@@ -36,6 +36,8 @@ import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableExistsException;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.master.assignment.RegionStates;
+import org.apache.hadoop.hbase.net.Address;
+import org.apache.hadoop.hbase.shaded.com.google.common.net.HostAndPort;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
 import org.apache.hadoop.hbase.testclassification.MasterTests;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -109,7 +111,6 @@ public class TestRestartCluster {
    * This tests retaining assignments on a cluster restart
    */
   @Test (timeout=300000)
-  @Ignore // Does not work in new AMv2 currently.
   public void testRetainAssignmentOnRestart() throws Exception {
     UTIL.startMiniCluster(2);
     while (!UTIL.getMiniHBaseCluster().getMaster().isInitialized()) {
@@ -163,7 +164,7 @@ public class TestRestartCluster {
     LOG.info("\n\nStarting cluster the second time with the same ports");
     try {
       cluster.getConf().setInt(
-        ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, 4);
+          ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, 3);
       master = cluster.startMaster().getMaster();
       for (int i = 0; i < 3; i++) {
         cluster.getConf().setInt(HConstants.REGIONSERVER_PORT, rsPorts[i]);
@@ -178,7 +179,7 @@ public class TestRestartCluster {
 
     // Make sure live regionservers are on the same host/port
     List<ServerName> localServers = master.getServerManager().getOnlineServersList();
-    assertEquals(4, localServers.size());
+    assertEquals(3, localServers.size());
     for (int i = 0; i < 3; i++) {
       boolean found = false;
       for (ServerName serverName: localServers) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticBalancerPickers.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticBalancerPickers.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticBalancerPickers.java
index d86d62d..fef7d30 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticBalancerPickers.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticBalancerPickers.java
@@ -133,7 +133,7 @@ public class TestFavoredStochasticBalancerPickers extends BalancerTestBase
{
     Map<ServerName, List<HRegionInfo>> serverAssignments = Maps.newHashMap();
     ClusterStatus status = admin.getClusterStatus();
     for (ServerName sn : status.getServers()) {
-      if (!ServerName.isSameHostnameAndPort(sn, masterServerName)) {
+      if (!ServerName.isSameAddress(sn, masterServerName)) {
         serverAssignments.put(sn, admin.getOnlineRegions(sn));
       }
     }
@@ -195,7 +195,7 @@ public class TestFavoredStochasticBalancerPickers extends BalancerTestBase
{
 
   private boolean doesMatchExcludeNodes(ArrayList<ServerName> excludeNodes, ServerName
sn) {
     for (ServerName excludeSN : excludeNodes) {
-      if (ServerName.isSameHostnameAndPort(sn, excludeSN)) {
+      if (ServerName.isSameAddress(sn, excludeSN)) {
         return true;
       }
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/6b21f888/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticLoadBalancer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticLoadBalancer.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticLoadBalancer.java
index 03285c6..ddba7ce 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticLoadBalancer.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticLoadBalancer.java
@@ -44,7 +44,6 @@ import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.favored.FavoredNodeAssignmentHelper;
 import org.apache.hadoop.hbase.favored.FavoredNodesPlan;
 import org.apache.hadoop.hbase.master.HMaster;
-import org.apache.hadoop.hbase.master.RegionState;
 import org.apache.hadoop.hbase.master.assignment.RegionStates;
 import org.apache.hadoop.hbase.master.assignment.RegionStates.RegionStateNode;
 import org.apache.hadoop.hbase.master.ServerManager;
@@ -220,7 +219,7 @@ public class TestFavoredStochasticLoadBalancer extends BalancerTestBase
{
     assertNotNull(favoredNodes);
     boolean containsFN = false;
     for (ServerName sn : favoredNodes) {
-      if (ServerName.isSameHostnameAndPort(destination, sn)) {
+      if (ServerName.isSameAddress(destination, sn)) {
         containsFN = true;
       }
     }
@@ -305,7 +304,7 @@ public class TestFavoredStochasticLoadBalancer extends BalancerTestBase
{
       @Override
       public boolean evaluate() throws Exception {
         ServerName host = regionStates.getRegionServerOfRegion(misplacedRegion);
-        return !ServerName.isSameHostnameAndPort(host, current);
+        return !ServerName.isSameAddress(host, current);
       }
     });
     checkFavoredNodeAssignments(tableName, fnm, regionStates);
@@ -516,7 +515,7 @@ public class TestFavoredStochasticLoadBalancer extends BalancerTestBase
{
   private void stopServersAndWaitUntilProcessed(List<ServerName> currentFN) throws
Exception {
     for (ServerName sn : currentFN) {
       for (JVMClusterUtil.RegionServerThread rst : cluster.getLiveRegionServerThreads())
{
-        if (ServerName.isSameHostnameAndPort(sn, rst.getRegionServer().getServerName()))
{
+        if (ServerName.isSameAddress(sn, rst.getRegionServer().getServerName())) {
           LOG.info("Shutting down server: " + sn);
           cluster.stopRegionServer(rst.getRegionServer().getServerName());
           cluster.waitForRegionServerToStop(rst.getRegionServer().getServerName(), 60000);


Mime
View raw message