hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1097275 [8/8] - in /hbase/trunk: ./ src/docbkx/ src/main/java/org/apache/hadoop/hbase/ src/main/java/org/apache/hadoop/hbase/avro/ src/main/java/org/apache/hadoop/hbase/catalog/ src/main/java/org/apache/hadoop/hbase/client/ src/main/java/o...
Date Wed, 27 Apr 2011 23:12:44 GMT
Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestHMasterRPCException.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestHMasterRPCException.java?rev=1097275&r1=1097274&r2=1097275&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestHMasterRPCException.java
(original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestHMasterRPCException.java
Wed Apr 27 23:12:42 2011
@@ -23,10 +23,12 @@ package org.apache.hadoop.hbase.master;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.net.InetSocketAddress;
+
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.HServerAddress;
+import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.ipc.HBaseRPC;
 import org.apache.hadoop.hbase.ipc.HMasterInterface;
 import org.apache.hadoop.ipc.RemoteException;
@@ -43,12 +45,11 @@ public class TestHMasterRPCException {
 
     HMaster hm = new HMaster(conf);
 
-    HServerAddress hma = hm.getMasterAddress();
+    ServerName sm = hm.getServerName();
+    InetSocketAddress isa = new InetSocketAddress(sm.getHostname(), sm.getPort());
     try {
-      HMasterInterface inf =
-          (HMasterInterface) HBaseRPC.getProxy(
-              HMasterInterface.class,  HMasterInterface.VERSION,
-              hma.getInetSocketAddress(), conf, 100);
+      HMasterInterface inf = (HMasterInterface) HBaseRPC.getProxy(
+        HMasterInterface.class,  HMasterInterface.VERSION, isa, conf, 100);
       inf.isMasterRunning();
       fail();
     } catch (RemoteException ex) {

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestLoadBalancer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestLoadBalancer.java?rev=1097275&r1=1097274&r2=1097275&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestLoadBalancer.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestLoadBalancer.java Wed Apr
27 23:12:42 2011
@@ -20,10 +20,11 @@
 package org.apache.hadoop.hbase.master;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -39,9 +40,8 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.HServerAddress;
-import org.apache.hadoop.hbase.HServerInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.master.LoadBalancer.RegionPlan;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.BeforeClass;
@@ -138,6 +138,38 @@ public class TestLoadBalancer {
       new int [] { 12, 100 },
   };
 
+  @Test
+  public void testRandomizer() {
+    for(int [] mockCluster : clusterStateMocks) {
+      if (mockCluster.length < 5) continue;
+      Map<ServerName, List<HRegionInfo>> servers =
+        mockClusterServers(mockCluster);
+      for (Map.Entry<ServerName, List<HRegionInfo>> e: servers.entrySet()) {
+        List<HRegionInfo> original = e.getValue();
+        if (original.size() < 5) continue;
+        // Try ten times in case random chances upon original order more than
+        // one or two times in a row.
+        boolean same = true;
+        for (int i = 0; i < 10 && same; i++) {
+          List<HRegionInfo> copy = new ArrayList<HRegionInfo>(original);
+          System.out.println("Randomizing before " + copy.size());
+          for (HRegionInfo hri: copy) {
+            System.out.println(hri.getEncodedName());
+          }
+          List<HRegionInfo> randomized = LoadBalancer.randomize(copy);
+          System.out.println("Randomizing after " + randomized.size());
+          for (HRegionInfo hri: randomized) {
+            System.out.println(hri.getEncodedName());
+          }
+          if (original.equals(randomized)) continue;
+          same = false;
+          break;
+        }
+        assertFalse(same);
+      }
+    }
+  }
+
   /**
    * Test the load balancing algorithm.
    *
@@ -150,13 +182,14 @@ public class TestLoadBalancer {
   public void testBalanceCluster() throws Exception {
 
     for(int [] mockCluster : clusterStateMocks) {
-      Map<HServerInfo,List<HRegionInfo>> servers = mockClusterServers(mockCluster);
-      LOG.info("Mock Cluster : " + printMock(servers) + " " + printStats(servers));
+      Map<ServerName, List<HRegionInfo>> servers =  mockClusterServers(mockCluster);
+      List <LoadBalancer.ServerAndLoad> list = convertToList(servers);
+      LOG.info("Mock Cluster : " + printMock(list) + " " + printStats(list));
       List<RegionPlan> plans = loadBalancer.balanceCluster(servers);
-      List<HServerInfo> balancedCluster = reconcile(servers, plans);
+      List<LoadBalancer.ServerAndLoad> balancedCluster = reconcile(list, plans);
       LOG.info("Mock Balance : " + printMock(balancedCluster));
       assertClusterAsBalanced(balancedCluster);
-      for(Map.Entry<HServerInfo, List<HRegionInfo>> entry : servers.entrySet())
{
+      for(Map.Entry<ServerName, List<HRegionInfo>> entry : servers.entrySet())
{
         returnRegions(entry.getValue());
         returnServer(entry.getKey());
       }
@@ -168,13 +201,13 @@ public class TestLoadBalancer {
    * Invariant is that all servers have between floor(avg) and ceiling(avg)
    * number of regions.
    */
-  public void assertClusterAsBalanced(List<HServerInfo> servers) {
+  public void assertClusterAsBalanced(List<LoadBalancer.ServerAndLoad> servers) {
     int numServers = servers.size();
     int numRegions = 0;
     int maxRegions = 0;
     int minRegions = Integer.MAX_VALUE;
-    for(HServerInfo server : servers) {
-      int nr = server.getLoad().getNumberOfRegions();
+    for(LoadBalancer.ServerAndLoad server : servers) {
+      int nr = server.getLoad();
       if(nr > maxRegions) {
         maxRegions = nr;
       }
@@ -190,9 +223,9 @@ public class TestLoadBalancer {
     int min = numRegions / numServers;
     int max = numRegions % numServers == 0 ? min : min + 1;
 
-    for(HServerInfo server : servers) {
-      assertTrue(server.getLoad().getNumberOfRegions() <= max);
-      assertTrue(server.getLoad().getNumberOfRegions() >= min);
+    for(LoadBalancer.ServerAndLoad server : servers) {
+      assertTrue(server.getLoad() <= max);
+      assertTrue(server.getLoad() >= min);
     }
   }
 
@@ -208,12 +241,13 @@ public class TestLoadBalancer {
     for(int [] mock : regionsAndServersMocks) {
       LOG.debug("testImmediateAssignment with " + mock[0] + " regions and " + mock[1] + "
servers");
       List<HRegionInfo> regions = randomRegions(mock[0]);
-      List<HServerInfo> servers = randomServers(mock[1], 0);
-      Map<HRegionInfo,HServerInfo> assignments =
-        LoadBalancer.immediateAssignment(regions, servers);
-      assertImmediateAssignment(regions, servers, assignments);
+      List<LoadBalancer.ServerAndLoad> servers = randomServers(mock[1], 0);
+      List<ServerName> list = getListOfServerNames(servers);
+      Map<HRegionInfo,ServerName> assignments =
+        LoadBalancer.immediateAssignment(regions, list);
+      assertImmediateAssignment(regions, list, assignments);
       returnRegions(regions);
-      returnServers(servers);
+      returnServers(list);
     }
   }
 
@@ -224,7 +258,7 @@ public class TestLoadBalancer {
    * @param assignments
    */
   private void assertImmediateAssignment(List<HRegionInfo> regions,
-      List<HServerInfo> servers, Map<HRegionInfo,HServerInfo> assignments) {
+      List<ServerName> servers, Map<HRegionInfo, ServerName> assignments) {
     for(HRegionInfo region : regions) {
       assertTrue(assignments.containsKey(region));
     }
@@ -243,9 +277,10 @@ public class TestLoadBalancer {
     for(int [] mock : regionsAndServersMocks) {
       LOG.debug("testBulkAssignment with " + mock[0] + " regions and " + mock[1] + " servers");
       List<HRegionInfo> regions = randomRegions(mock[0]);
-      List<HServerInfo> servers = randomServers(mock[1], 0);
-      Map<HServerInfo,List<HRegionInfo>> assignments =
-        LoadBalancer.roundRobinAssignment(regions.toArray(new HRegionInfo[regions.size()]),
servers);
+      List<LoadBalancer.ServerAndLoad> servers = randomServers(mock[1], 0);
+      List<ServerName> list = getListOfServerNames(servers);
+      Map<ServerName, List<HRegionInfo>> assignments =
+        LoadBalancer.roundRobinAssignment(regions, list);
       float average = (float)regions.size()/servers.size();
       int min = (int)Math.floor(average);
       int max = (int)Math.ceil(average);
@@ -255,7 +290,7 @@ public class TestLoadBalancer {
         }
       }
       returnRegions(regions);
-      returnServers(servers);
+      returnServers(list);
     }
   }
 
@@ -267,31 +302,43 @@ public class TestLoadBalancer {
   @Test
   public void testRetainAssignment() throws Exception {
     // Test simple case where all same servers are there
-    List<HServerInfo> servers = randomServers(10, 10);
+    List<LoadBalancer.ServerAndLoad> servers = randomServers(10, 10);
     List<HRegionInfo> regions = randomRegions(100);
-    Map<HRegionInfo, HServerAddress> existing =
-      new TreeMap<HRegionInfo, HServerAddress>();
-    for (int i=0;i<regions.size();i++) {
-      existing.put(regions.get(i),
-          servers.get(i % servers.size()).getServerAddress());
-    }
-    Map<HServerInfo, List<HRegionInfo>> assignment =
-      LoadBalancer.retainAssignment(existing, servers);
-    assertRetainedAssignment(existing, servers, assignment);
+    Map<HRegionInfo, ServerName> existing =
+      new TreeMap<HRegionInfo, ServerName>();
+    for (int i = 0; i < regions.size(); i++) {
+      existing.put(regions.get(i), servers.get(i % servers.size()).getServerName());
+    }
+    List<ServerName> listOfServerNames = getListOfServerNames(servers);
+    Map<ServerName, List<HRegionInfo>> assignment =
+      LoadBalancer.retainAssignment(existing, listOfServerNames);
+    assertRetainedAssignment(existing, listOfServerNames, assignment);
 
     // Include two new servers that were not there before
-    List<HServerInfo> servers2 = new ArrayList<HServerInfo>(servers);
+    List<LoadBalancer.ServerAndLoad> servers2 =
+      new ArrayList<LoadBalancer.ServerAndLoad>(servers);
     servers2.add(randomServer(10));
     servers2.add(randomServer(10));
-    assignment = LoadBalancer.retainAssignment(existing, servers2);
-    assertRetainedAssignment(existing, servers2, assignment);
+    listOfServerNames = getListOfServerNames(servers2);
+    assignment = LoadBalancer.retainAssignment(existing, listOfServerNames);
+    assertRetainedAssignment(existing, listOfServerNames, assignment);
 
     // Remove two of the servers that were previously there
-    List<HServerInfo> servers3 = new ArrayList<HServerInfo>(servers);
+    List<LoadBalancer.ServerAndLoad> servers3 =
+      new ArrayList<LoadBalancer.ServerAndLoad>(servers);
     servers3.remove(servers3.size()-1);
     servers3.remove(servers3.size()-2);
-    assignment = LoadBalancer.retainAssignment(existing, servers3);
-    assertRetainedAssignment(existing, servers3, assignment);
+    listOfServerNames = getListOfServerNames(servers2);
+    assignment = LoadBalancer.retainAssignment(existing, listOfServerNames);
+    assertRetainedAssignment(existing, listOfServerNames, assignment);
+  }
+
+  private List<ServerName> getListOfServerNames(final List<LoadBalancer.ServerAndLoad>
sals) {
+    List<ServerName> list = new ArrayList<ServerName>();
+    for (LoadBalancer.ServerAndLoad e: sals) {
+      list.add(e.getServerName());
+    }
+    return list;
   }
 
   /**
@@ -308,12 +355,12 @@ public class TestLoadBalancer {
    * @param assignment
    */
   private void assertRetainedAssignment(
-      Map<HRegionInfo, HServerAddress> existing, List<HServerInfo> servers,
-      Map<HServerInfo, List<HRegionInfo>> assignment) {
+      Map<HRegionInfo, ServerName> existing, List<ServerName> servers,
+      Map<ServerName, List<HRegionInfo>> assignment) {
     // Verify condition 1, every region assigned, and to online server
-    Set<HServerInfo> onlineServerSet = new TreeSet<HServerInfo>(servers);
+    Set<ServerName> onlineServerSet = new TreeSet<ServerName>(servers);
     Set<HRegionInfo> assignedRegions = new TreeSet<HRegionInfo>();
-    for (Map.Entry<HServerInfo, List<HRegionInfo>> a : assignment.entrySet())
{
+    for (Map.Entry<ServerName, List<HRegionInfo>> a : assignment.entrySet())
{
       assertTrue("Region assigned to server that was not listed as online",
           onlineServerSet.contains(a.getKey()));
       for (HRegionInfo r : a.getValue()) assignedRegions.add(r);
@@ -321,23 +368,23 @@ public class TestLoadBalancer {
     assertEquals(existing.size(), assignedRegions.size());
 
     // Verify condition 2, if server had existing assignment, must have same
-    Set<HServerAddress> onlineAddresses = new TreeSet<HServerAddress>();
-    for (HServerInfo s : servers) onlineAddresses.add(s.getServerAddress());
-    for (Map.Entry<HServerInfo, List<HRegionInfo>> a : assignment.entrySet())
{
+    Set<ServerName> onlineAddresses = new TreeSet<ServerName>();
+    for (ServerName s : servers) onlineAddresses.add(s);
+    for (Map.Entry<ServerName, List<HRegionInfo>> a : assignment.entrySet())
{
       for (HRegionInfo r : a.getValue()) {
-        HServerAddress address = existing.get(r);
+        ServerName address = existing.get(r);
         if (address != null && onlineAddresses.contains(address)) {
-          assertTrue(a.getKey().getServerAddress().equals(address));
+          assertTrue(a.getKey().equals(address));
         }
       }
     }
   }
 
-  private String printStats(Map<HServerInfo, List<HRegionInfo>> servers) {
+  private String printStats(List<LoadBalancer.ServerAndLoad> servers) {
     int numServers = servers.size();
     int totalRegions = 0;
-    for(HServerInfo server : servers.keySet()) {
-      totalRegions += server.getLoad().getNumberOfRegions();
+    for(LoadBalancer.ServerAndLoad server : servers) {
+      totalRegions += server.getLoad();
     }
     float average = (float)totalRegions / numServers;
     int max = (int)Math.ceil(average);
@@ -345,20 +392,31 @@ public class TestLoadBalancer {
     return "[srvr=" + numServers + " rgns=" + totalRegions + " avg=" + average + " max="
+ max + " min=" + min + "]";
   }
 
-  private String printMock(Map<HServerInfo, List<HRegionInfo>> servers) {
-    return printMock(Arrays.asList(servers.keySet().toArray(new HServerInfo[servers.size()])));
+  private List<LoadBalancer.ServerAndLoad> convertToList(final Map<ServerName, List<HRegionInfo>>
servers) {
+    List<LoadBalancer.ServerAndLoad> list =
+      new ArrayList<LoadBalancer.ServerAndLoad>(servers.size());
+    for (Map.Entry<ServerName, List<HRegionInfo>> e: servers.entrySet()) {
+      list.add(new LoadBalancer.ServerAndLoad(e.getKey(), e.getValue().size()));
+    }
+    return list;
   }
 
-  private String printMock(List<HServerInfo> balancedCluster) {
-    SortedSet<HServerInfo> sorted = new TreeSet<HServerInfo>(balancedCluster);
-    HServerInfo [] arr = sorted.toArray(new HServerInfo[sorted.size()]);
+  private String printMock(Map<ServerName, List<HRegionInfo>> servers) {
+    return printMock(convertToList(servers));
+  }
+
+  private String printMock(List<LoadBalancer.ServerAndLoad> balancedCluster) {
+    SortedSet<LoadBalancer.ServerAndLoad> sorted =
+      new TreeSet<LoadBalancer.ServerAndLoad>(balancedCluster);
+    LoadBalancer.ServerAndLoad [] arr =
+      sorted.toArray(new LoadBalancer.ServerAndLoad[sorted.size()]);
     StringBuilder sb = new StringBuilder(sorted.size() * 4 + 4);
     sb.append("{ ");
-    for(int i=0;i<arr.length;i++) {
-      if(i != 0) {
+    for(int i = 0; i < arr.length; i++) {
+      if (i != 0) {
         sb.append(" , ");
       }
-      sb.append(arr[i].getLoad().getNumberOfRegions());
+      sb.append(arr[i].getLoad());
     }
     sb.append(" }");
     return sb.toString();
@@ -371,29 +429,42 @@ public class TestLoadBalancer {
    * @param plans
    * @return
    */
-  private List<HServerInfo> reconcile(
-      Map<HServerInfo, List<HRegionInfo>> servers, List<RegionPlan> plans)
{
-    if(plans != null) {
-      for(RegionPlan plan : plans) {
-        plan.getSource().getLoad().setNumberOfRegions(
-            plan.getSource().getLoad().getNumberOfRegions() - 1);
-        plan.getDestination().getLoad().setNumberOfRegions(
-            plan.getDestination().getLoad().getNumberOfRegions() + 1);
-      }
-    }
-    return Arrays.asList(servers.keySet().toArray(new HServerInfo[servers.size()]));
+  private List<LoadBalancer.ServerAndLoad> reconcile(List<LoadBalancer.ServerAndLoad>
list,
+      List<RegionPlan> plans) {
+    List<LoadBalancer.ServerAndLoad> result =
+      new ArrayList<LoadBalancer.ServerAndLoad>(list.size());
+    if (plans == null) return result;
+    Map<ServerName, LoadBalancer.ServerAndLoad> map =
+      new HashMap<ServerName, LoadBalancer.ServerAndLoad>(list.size());
+    for (RegionPlan plan : plans) {
+      ServerName source = plan.getSource();
+      updateLoad(map, source, -1);
+      ServerName destination = plan.getDestination();
+      updateLoad(map, destination, +1);
+    }
+    result.clear();
+    result.addAll(map.values());
+    return result;
+  }
+
+  private void updateLoad(Map<ServerName, LoadBalancer.ServerAndLoad> map,
+      final ServerName sn, final int diff) {
+    LoadBalancer.ServerAndLoad sal = map.get(sn);
+    if (sal == null) return;
+    sal = new LoadBalancer.ServerAndLoad(sn, sal.getLoad() + diff);
+    map.put(sn, sal);
   }
 
-  private Map<HServerInfo, List<HRegionInfo>> mockClusterServers(
+  private Map<ServerName, List<HRegionInfo>> mockClusterServers(
       int [] mockCluster) {
     int numServers = mockCluster.length;
-    Map<HServerInfo,List<HRegionInfo>> servers =
-      new TreeMap<HServerInfo,List<HRegionInfo>>();
-    for(int i=0;i<numServers;i++) {
+    Map<ServerName, List<HRegionInfo>> servers =
+      new TreeMap<ServerName, List<HRegionInfo>>();
+    for(int i = 0; i < numServers; i++) {
       int numRegions = mockCluster[i];
-      HServerInfo server = randomServer(numRegions);
+      LoadBalancer.ServerAndLoad sal = randomServer(0);
       List<HRegionInfo> regions = randomRegions(numRegions);
-      servers.put(server, regions);
+      servers.put(sal.getServerName(), regions);
     }
     return servers;
   }
@@ -426,36 +497,34 @@ public class TestLoadBalancer {
     regionQueue.addAll(regions);
   }
 
-  private Queue<HServerInfo> serverQueue = new LinkedList<HServerInfo>();
+  private Queue<ServerName> serverQueue = new LinkedList<ServerName>();
 
-  private HServerInfo randomServer(int numRegions) {
-    if(!serverQueue.isEmpty()) {
-      HServerInfo server = this.serverQueue.poll();
-      server.getLoad().setNumberOfRegions(numRegions);
-      return server;
+  private LoadBalancer.ServerAndLoad randomServer(final int numRegionsPerServer) {
+    if (!this.serverQueue.isEmpty()) {
+      ServerName sn = this.serverQueue.poll();
+      return new LoadBalancer.ServerAndLoad(sn, numRegionsPerServer);
     }
     String host = "127.0.0.1";
     int port = rand.nextInt(60000);
     long startCode = rand.nextLong();
-    HServerInfo hsi =
-      new HServerInfo(new HServerAddress(host, port), startCode, port, host);
-    hsi.getLoad().setNumberOfRegions(numRegions);
-    return hsi;
+    ServerName sn = new ServerName(host, port, startCode);
+    return new LoadBalancer.ServerAndLoad(sn, numRegionsPerServer);
   }
 
-  private List<HServerInfo> randomServers(int numServers, int numRegionsPerServer)
{
-    List<HServerInfo> servers = new ArrayList<HServerInfo>(numServers);
-    for(int i=0;i<numServers;i++) {
+  private List<LoadBalancer.ServerAndLoad> randomServers(int numServers, int numRegionsPerServer)
{
+    List<LoadBalancer.ServerAndLoad> servers =
+      new ArrayList<LoadBalancer.ServerAndLoad>(numServers);
+    for (int i = 0; i < numServers; i++) {
       servers.add(randomServer(numRegionsPerServer));
     }
     return servers;
   }
 
-  private void returnServer(HServerInfo server) {
+  private void returnServer(ServerName server) {
     serverQueue.add(server);
   }
 
-  private void returnServers(List<HServerInfo> servers) {
-    serverQueue.addAll(servers);
+  private void returnServers(List<ServerName> servers) {
+    this.serverQueue.addAll(servers);
   }
 }

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestLogsCleaner.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestLogsCleaner.java?rev=1097275&r1=1097274&r2=1097275&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestLogsCleaner.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestLogsCleaner.java Wed Apr
27 23:12:42 2011
@@ -32,6 +32,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.Server;
+import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.catalog.CatalogTracker;
 import org.apache.hadoop.hbase.replication.ReplicationZookeeper;
 import org.apache.hadoop.hbase.replication.regionserver.Replication;
@@ -71,7 +72,8 @@ public class TestLogsCleaner {
 
     Path oldLogDir = new Path(HBaseTestingUtility.getTestDir(),
         HConstants.HREGION_OLDLOGDIR_NAME);
-    String fakeMachineName = URLEncoder.encode(server.getServerName(), "UTF8");
+    String fakeMachineName =
+      URLEncoder.encode(server.getServerName().toString(), "UTF8");
 
     FileSystem fs = FileSystem.get(conf);
     LogCleaner cleaner  = new LogCleaner(1000, server, conf, fs, oldLogDir);
@@ -146,8 +148,8 @@ public class TestLogsCleaner {
     }
 
     @Override
-    public String getServerName() {
-      return "regionserver,60020,000000";
+    public ServerName getServerName() {
+      return new ServerName("regionserver,60020,000000");
     }
 
     @Override

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMaster.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMaster.java?rev=1097275&r1=1097274&r2=1097275&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMaster.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMaster.java Wed Apr 27 23:12:42
2011
@@ -25,7 +25,7 @@ import org.apache.hadoop.hbase.HConstant
 import org.apache.hadoop.hbase.MiniHBaseCluster;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.HServerAddress;
+import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.catalog.MetaReader;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
@@ -75,7 +75,7 @@ public class TestMaster {
     TEST_UTIL.loadTable(new HTable(TEST_UTIL.getConfiguration(), TABLENAME),
       FAMILYNAME);
 
-    List<Pair<HRegionInfo, HServerAddress>> tableRegions =
+    List<Pair<HRegionInfo, ServerName>> tableRegions =
       MetaReader.getTableRegionsAndLocations(m.getCatalogTracker(),
           Bytes.toString(TABLENAME));
     LOG.info("Regions after load: " + Joiner.on(',').join(tableRegions));
@@ -106,10 +106,10 @@ public class TestMaster {
       // We have three regions because one is split-in-progress
       assertEquals(3, tableRegions.size());
       LOG.info("Making sure we can call getTableRegionClosest while opening");
-      Pair<HRegionInfo,HServerAddress> pair =
+      Pair<HRegionInfo, ServerName> pair =
         m.getTableRegionForRow(TABLENAME, Bytes.toBytes("cde"));
       LOG.info("Result is: " + pair);
-      Pair<HRegionInfo, HServerAddress> tableRegionFromName =
+      Pair<HRegionInfo, ServerName> tableRegionFromName =
         MetaReader.getRegion(m.getCatalogTracker(),
             pair.getFirst().getRegionName());
       assertEquals(tableRegionFromName.getFirst(), pair.getFirst());

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java?rev=1097275&r1=1097274&r2=1097275&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java Wed Apr
27 23:12:42 2011
@@ -36,9 +36,9 @@ import org.apache.hadoop.hbase.HBaseConf
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.HServerInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
+import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.executor.RegionTransitionData;
 import org.apache.hadoop.hbase.executor.EventHandler.EventType;
 import org.apache.hadoop.hbase.master.AssignmentManager.RegionState;
@@ -85,7 +85,7 @@ public class TestMasterFailover {
     // verify only one is the active master and we have right number
     int numActive = 0;
     int activeIndex = -1;
-    String activeName = null;
+    ServerName activeName = null;
     for (int i = 0; i < masterThreads.size(); i++) {
       if (masterThreads.get(i).getMaster().isActiveMaster()) {
         numActive++;
@@ -278,8 +278,7 @@ public class TestMasterFailover {
 
     // Let's just assign everything to first RS
     HRegionServer hrs = cluster.getRegionServer(0);
-    String serverName = hrs.getServerName();
-    HServerInfo hsiAlive = hrs.getServerInfo();
+    ServerName serverName = hrs.getServerName();
 
     // we'll need some regions to already be assigned out properly on live RS
     List<HRegionInfo> enabledAndAssignedRegions = new ArrayList<HRegionInfo>();
@@ -292,12 +291,12 @@ public class TestMasterFailover {
     // now actually assign them
     for (HRegionInfo hri : enabledAndAssignedRegions) {
       master.assignmentManager.regionPlans.put(hri.getEncodedName(),
-          new RegionPlan(hri, null, hsiAlive));
+          new RegionPlan(hri, null, serverName));
       master.assignRegion(hri);
     }
     for (HRegionInfo hri : disabledAndAssignedRegions) {
       master.assignmentManager.regionPlans.put(hri.getEncodedName(),
-          new RegionPlan(hri, null, hsiAlive));
+          new RegionPlan(hri, null, serverName));
       master.assignRegion(hri);
     }
 
@@ -583,12 +582,10 @@ public class TestMasterFailover {
 
     // The first RS will stay online
     HRegionServer hrs = cluster.getRegionServer(0);
-    HServerInfo hsiAlive = hrs.getServerInfo();
 
     // The second RS is going to be hard-killed
     HRegionServer hrsDead = cluster.getRegionServer(1);
-    String deadServerName = hrsDead.getServerName();
-    HServerInfo hsiDead = hrsDead.getServerInfo();
+    ServerName deadServerName = hrsDead.getServerName();
 
     // we'll need some regions to already be assigned out properly on live RS
     List<HRegionInfo> enabledAndAssignedRegions = new ArrayList<HRegionInfo>();
@@ -601,12 +598,12 @@ public class TestMasterFailover {
     // now actually assign them
     for (HRegionInfo hri : enabledAndAssignedRegions) {
       master.assignmentManager.regionPlans.put(hri.getEncodedName(),
-          new RegionPlan(hri, null, hsiAlive));
+          new RegionPlan(hri, null, hrs.getServerName()));
       master.assignRegion(hri);
     }
     for (HRegionInfo hri : disabledAndAssignedRegions) {
       master.assignmentManager.regionPlans.put(hri.getEncodedName(),
-          new RegionPlan(hri, null, hsiAlive));
+          new RegionPlan(hri, null, hrs.getServerName()));
       master.assignRegion(hri);
     }
 
@@ -621,12 +618,12 @@ public class TestMasterFailover {
     // set region plan to server to be killed and trigger assign
     for (HRegionInfo hri : enabledAndOnDeadRegions) {
       master.assignmentManager.regionPlans.put(hri.getEncodedName(),
-          new RegionPlan(hri, null, hsiDead));
+          new RegionPlan(hri, null, deadServerName));
       master.assignRegion(hri);
     }
     for (HRegionInfo hri : disabledAndOnDeadRegions) {
       master.assignmentManager.regionPlans.put(hri.getEncodedName(),
-          new RegionPlan(hri, null, hsiDead));
+          new RegionPlan(hri, null, deadServerName));
       master.assignRegion(hri);
     }
 

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestRestartCluster.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestRestartCluster.java?rev=1097275&r1=1097274&r2=1097275&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestRestartCluster.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestRestartCluster.java Wed Apr
27 23:12:42 2011
@@ -30,6 +30,7 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableExistsException;
 import org.apache.hadoop.hbase.client.MetaScanner;
 import org.apache.hadoop.hbase.executor.EventHandler.EventType;
@@ -72,11 +73,11 @@ public class TestRestartCluster {
     String unassignedZNode = zooKeeper.assignmentZNode;
     ZKUtil.createAndFailSilent(zooKeeper, unassignedZNode);
 
-    ZKAssign.createNodeOffline(zooKeeper, HRegionInfo.ROOT_REGIONINFO,
-      HMaster.MASTER);
+    ServerName sn = new ServerName(HMaster.MASTER, -1, System.currentTimeMillis());
 
-    ZKAssign.createNodeOffline(zooKeeper, HRegionInfo.FIRST_META_REGIONINFO,
-      HMaster.MASTER);
+    ZKAssign.createNodeOffline(zooKeeper, HRegionInfo.ROOT_REGIONINFO, sn);
+
+    ZKAssign.createNodeOffline(zooKeeper, HRegionInfo.FIRST_META_REGIONINFO, sn);
 
     LOG.debug("Created UNASSIGNED zNode for ROOT and META regions in state " +
         EventType.M_ZK_REGION_OFFLINE);
@@ -132,4 +133,4 @@ public class TestRestartCluster {
       UTIL.waitTableAvailable(TABLE, 30000);
     }
   }
-}
+}
\ No newline at end of file

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestRollingRestart.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestRollingRestart.java?rev=1097275&r1=1097274&r2=1097275&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestRollingRestart.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/master/TestRollingRestart.java Wed Apr
27 23:12:42 2011
@@ -32,6 +32,7 @@ import org.apache.hadoop.hbase.HBaseConf
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
+import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread;
@@ -155,7 +156,7 @@ public class TestRollingRestart {
     int num = 1;
     int total = regionServers.size();
     for (RegionServerThread rst : regionServers) {
-      String serverName = rst.getRegionServer().getServerName();
+      ServerName serverName = rst.getRegionServer().getServerName();
       log("Stopping region server " + num + " of " + total + " [ " +
           serverName + "]");
       rst.getRegionServer().stop("Stopping RS during rolling restart");
@@ -302,7 +303,7 @@ public class TestRollingRestart {
   }
 
   private void waitForRSShutdownToStartAndFinish(MasterThread activeMaster,
-      String serverName) throws InterruptedException {
+      ServerName serverName) throws InterruptedException {
     ServerManager sm = activeMaster.getMaster().getServerManager();
     // First wait for it to be in dead list
     while (!sm.getDeadServers().contains(serverName)) {

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressManager.java?rev=1097275&r1=1097274&r2=1097275&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressManager.java
(original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressManager.java
Wed Apr 27 23:12:42 2011
@@ -27,8 +27,8 @@ import java.util.concurrent.Semaphore;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
-import org.apache.hadoop.hbase.HServerAddress;
 import org.apache.hadoop.hbase.MasterAddressTracker;
+import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.zookeeper.ZKUtil;
 import org.apache.hadoop.hbase.zookeeper.ZooKeeperListener;
 import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
@@ -75,17 +75,17 @@ public class TestMasterAddressManager {
     // Create the master node with a dummy address
     String host = "localhost";
     int port = 1234;
-    HServerAddress dummyAddress = new HServerAddress(host, port);
+    ServerName sn = new ServerName(host, port, System.currentTimeMillis());
     LOG.info("Creating master node");
-    ZKUtil.setAddressAndWatch(zk, zk.masterAddressZNode, dummyAddress);
+    ZKUtil.createEphemeralNodeAndWatch(zk, zk.masterAddressZNode, sn.getBytes());
 
     // Wait for the node to be created
     LOG.info("Waiting for master address manager to be notified");
     listener.waitForCreation();
     LOG.info("Master node created");
     assertTrue(addressManager.hasMaster());
-    HServerAddress pulledAddress = addressManager.getMasterAddress();
-    assertTrue(pulledAddress.equals(dummyAddress));
+    ServerName pulledAddress = addressManager.getMasterAddress();
+    assertTrue(pulledAddress.equals(sn));
 
   }
 

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanner.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanner.java?rev=1097275&r1=1097274&r2=1097275&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanner.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanner.java Wed Apr
27 23:12:42 2011
@@ -31,7 +31,6 @@ import org.apache.hadoop.hbase.HBaseTest
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.HServerAddress;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.UnknownScannerException;
@@ -263,11 +262,11 @@ public class TestScanner extends HBaseTe
 
       // Store some new information
 
-      HServerAddress address = new HServerAddress("foo.bar.com:1234");
+      String address = "foo.bar.com:1234";
 
       put = new Put(ROW_KEY, System.currentTimeMillis(), null);
       put.add(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER,
-          Bytes.toBytes(address.toString()));
+          Bytes.toBytes(address));
 
 //      put.add(HConstants.COL_STARTCODE, Bytes.toBytes(START_CODE));
 
@@ -301,12 +300,12 @@ public class TestScanner extends HBaseTe
 
       // Now update the information again
 
-      address = new HServerAddress("bar.foo.com:4321");
+      address = "bar.foo.com:4321";
 
       put = new Put(ROW_KEY, System.currentTimeMillis(), null);
 
       put.add(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER,
-          Bytes.toBytes(address.toString()));
+          Bytes.toBytes(address));
       region.put(put);
 
       // Validate again

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java?rev=1097275&r1=1097274&r2=1097275&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
(original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
Wed Apr 27 23:12:42 2011
@@ -33,6 +33,7 @@ import org.apache.hadoop.hbase.HConstant
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.MasterNotRunningException;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
+import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.UnknownRegionException;
 import org.apache.hadoop.hbase.ZooKeeperConnectionException;
 import org.apache.hadoop.hbase.client.Delete;
@@ -258,7 +259,7 @@ public class TestSplitTransactionOnClust
       // Insert into zk a blocking znode, a znode of same name as region
       // so it gets in way of our splitting.
       ZKAssign.createNodeClosing(t.getConnection().getZooKeeperWatcher(),
-        hri, "anyOldServer");
+        hri, new ServerName("any.old.server", 1234, -1));
       // Now try splitting.... should fail.  And each should successfully
       // rollback.
       this.admin.split(hri.getRegionNameAsString());
@@ -455,7 +456,7 @@ public class TestSplitTransactionOnClust
       HRegionServer hrs = getOtherRegionServer(cluster, metaRegionServer);
       LOG.info("Moving " + hri.getRegionNameAsString() + " to " +
         hrs.getServerName() + "; metaServerIndex=" + metaServerIndex);
-      admin.move(hri.getEncodedNameAsBytes(), Bytes.toBytes(hrs.getServerName()));
+      admin.move(hri.getEncodedNameAsBytes(), hrs.getServerName().getBytes());
     }
     // Wait till table region is up on the server that is NOT carrying .META..
     while (true) {

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/handler/TestOpenRegionHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/handler/TestOpenRegionHandler.java?rev=1097275&r1=1097274&r2=1097275&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/handler/TestOpenRegionHandler.java
(original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/handler/TestOpenRegionHandler.java
Wed Apr 27 23:12:42 2011
@@ -31,9 +31,9 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.HServerInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.Server;
+import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.ZooKeeperConnectionException;
 import org.apache.hadoop.hbase.catalog.CatalogTracker;
 import org.apache.hadoop.hbase.ipc.HBaseRpcMetrics;
@@ -72,11 +72,11 @@ public class TestOpenRegionHandler {
    */
   static class MockServer implements Server {
     boolean stopped = false;
-    final static String NAME = "MockServer";
+    final static ServerName NAME = new ServerName("MockServer", 123, -1);
     final ZooKeeperWatcher zk;
 
     MockServer() throws ZooKeeperConnectionException, IOException {
-      this.zk =  new ZooKeeperWatcher(HTU.getConfiguration(), NAME, this);
+      this.zk =  new ZooKeeperWatcher(HTU.getConfiguration(), NAME.toString(), this);
     }
 
     @Override
@@ -113,7 +113,7 @@ public class TestOpenRegionHandler {
     }
 
     @Override
-    public String getServerName() {
+    public ServerName getServerName() {
       return NAME;
     }
   }
@@ -155,12 +155,7 @@ public class TestOpenRegionHandler {
     public HLog getWAL() {
       return null;
     }
-    
-    @Override
-    public HServerInfo getServerInfo() {
-      return null;
-    }
-    
+
     @Override
     public HBaseRpcMetrics getRpcMetrics() {
       return null;
@@ -196,7 +191,7 @@ public class TestOpenRegionHandler {
     }
 
     @Override
-    public String getServerName() {
+    public ServerName getServerName() {
       return null;
     }
 

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java?rev=1097275&r1=1097274&r2=1097275&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java
(original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManager.java
Wed Apr 27 23:12:42 2011
@@ -19,6 +19,12 @@
  */
 package org.apache.hadoop.hbase.replication.regionserver;
 
+import static org.junit.Assert.assertEquals;
+
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -32,6 +38,7 @@ import org.apache.hadoop.hbase.HRegionIn
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.Server;
+import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.catalog.CatalogTracker;
 import org.apache.hadoop.hbase.regionserver.wal.HLog;
 import org.apache.hadoop.hbase.regionserver.wal.HLogKey;
@@ -45,16 +52,8 @@ import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import static org.junit.Assert.assertEquals;
-
 public class TestReplicationSourceManager {
 
   private static final Log LOG =
@@ -225,7 +224,7 @@ public class TestReplicationSourceManage
     }
 
     @Override
-    public String getServerName() {
+    public ServerName getServerName() {
       return null;  //To change body of implemented methods use File | Settings | File Templates.
     }
 

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java?rev=1097275&r1=1097274&r2=1097275&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java Wed Apr 27 23:12:42
2011
@@ -26,8 +26,8 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.HServerInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
@@ -82,15 +82,15 @@ public class TestHBaseFsck {
       for (JVMClusterUtil.RegionServerThread rs :
           TEST_UTIL.getHBaseCluster().getRegionServerThreads()) {
 
-        HServerInfo hsi = rs.getRegionServer().getServerInfo();
+        ServerName sn = rs.getRegionServer().getServerName();
 
         // When we find a diff RS, change the assignment and break
-        if (startCode != hsi.getStartCode()) {
+        if (startCode != sn.getStartcode()) {
           Put put = new Put(res.getRow());
           put.add(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER,
-              Bytes.toBytes(hsi.getHostnamePort()));
+            Bytes.toBytes(sn.getHostAndPort()));
           put.add(HConstants.CATALOG_FAMILY, HConstants.STARTCODE_QUALIFIER,
-              Bytes.toBytes(hsi.getStartCode()));
+            Bytes.toBytes(sn.getStartcode()));
           meta.put(put);
           break resforloop;
         }



Mime
View raw message