hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chia7...@apache.org
Subject [12/19] hbase git commit: HBASE-18839 Apply RegionInfo to code base
Date Thu, 28 Sep 2017 12:30:42 GMT
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
index ca73ff7..a05ad67 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/BaseLoadBalancer.java
@@ -43,10 +43,10 @@ import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseIOException;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HDFSBlocksDistribution;
-import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.ServerLoad;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.hadoop.hbase.client.RegionReplicaUtil;
 import org.apache.hadoop.hbase.master.LoadBalancer;
 import org.apache.hadoop.hbase.master.MasterServices;
@@ -71,7 +71,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
   protected static final int MIN_SERVER_BALANCE = 2;
   private volatile boolean stopped = false;
 
-  private static final List<HRegionInfo> EMPTY_REGION_LIST = new ArrayList<>(0);
+  private static final List<RegionInfo> EMPTY_REGION_LIST = new ArrayList<>(0);
 
   static final Predicate<ServerLoad> IDLE_SERVER_PREDICATOR
     = load -> load.getNumberOfRegions() == 0;
@@ -127,7 +127,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
     boolean multiServersPerHost = false; // whether or not any host has more than one server
 
     ArrayList<String> tables;
-    HRegionInfo[] regions;
+    RegionInfo[] regions;
     Deque<BalancerRegionLoad>[] regionLoads;
     private RegionLocationFinder regionFinder;
 
@@ -160,7 +160,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
     Map<String, Integer> hostsToIndex;
     Map<String, Integer> racksToIndex;
     Map<String, Integer> tablesToIndex;
-    Map<HRegionInfo, Integer> regionsToIndex;
+    Map<RegionInfo, Integer> regionsToIndex;
     float[] localityPerServer;
 
     int numServers;
@@ -170,7 +170,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
     int numRegions;
 
     int numMovedRegions = 0; //num moved regions from the initial configuration
-    Map<ServerName, List<HRegionInfo>> clusterState;
+    Map<ServerName, List<RegionInfo>> clusterState;
 
     protected final RackManager rackManager;
     // Maps region -> rackIndex -> locality of region on rack
@@ -179,7 +179,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
     private int[][] regionsToMostLocalEntities;
 
     protected Cluster(
-        Map<ServerName, List<HRegionInfo>> clusterState,
+        Map<ServerName, List<RegionInfo>> clusterState,
         Map<String, Deque<BalancerRegionLoad>> loads,
         RegionLocationFinder regionFinder,
         RackManager rackManager) {
@@ -188,8 +188,8 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
 
     @SuppressWarnings("unchecked")
     protected Cluster(
-        Collection<HRegionInfo> unassignedRegions,
-        Map<ServerName, List<HRegionInfo>> clusterState,
+        Collection<RegionInfo> unassignedRegions,
+        Map<ServerName, List<RegionInfo>> clusterState,
         Map<String, Deque<BalancerRegionLoad>> loads,
         RegionLocationFinder regionFinder,
         RackManager rackManager) {
@@ -247,7 +247,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
       }
 
       // Count how many regions there are.
-      for (Entry<ServerName, List<HRegionInfo>> entry : clusterState.entrySet()) {
+      for (Entry<ServerName, List<RegionInfo>> entry : clusterState.entrySet()) {
         numRegions += entry.getValue().size();
       }
       numRegions += unassignedRegions.size();
@@ -256,7 +256,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
       servers = new ServerName[numServers];
       serversPerHost = new int[numHosts][];
       serversPerRack = new int[numRacks][];
-      regions = new HRegionInfo[numRegions];
+      regions = new RegionInfo[numRegions];
       regionIndexToServerIndex = new int[numRegions];
       initialRegionIndexToServerIndex = new int[numRegions];
       regionIndexToTableIndex = new int[numRegions];
@@ -279,7 +279,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
 
       int tableIndex = 0, regionIndex = 0, regionPerServerIndex = 0;
 
-      for (Entry<ServerName, List<HRegionInfo>> entry : clusterState.entrySet()) {
+      for (Entry<ServerName, List<RegionInfo>> entry : clusterState.entrySet()) {
         if (entry.getKey() == null) {
           LOG.warn("SERVERNAME IS NULL, skipping " + entry.getValue());
           continue;
@@ -314,7 +314,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
         racks[entry.getValue()] = entry.getKey();
       }
 
-      for (Entry<ServerName, List<HRegionInfo>> entry : clusterState.entrySet()) {
+      for (Entry<ServerName, List<RegionInfo>> entry : clusterState.entrySet()) {
         int serverIndex = serversToIndex.get(entry.getKey().getHostAndPort());
         regionPerServerIndex = 0;
 
@@ -324,14 +324,14 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
         int rackIndex = racksToIndex.get(this.rackManager.getRack(entry.getKey()));
         serverIndexToRackIndex[serverIndex] = rackIndex;
 
-        for (HRegionInfo region : entry.getValue()) {
+        for (RegionInfo region : entry.getValue()) {
           registerRegion(region, regionIndex, serverIndex, loads, regionFinder);
           regionsPerServer[serverIndex][regionPerServerIndex++] = regionIndex;
           regionIndex++;
         }
       }
 
-      for (HRegionInfo region : unassignedRegions) {
+      for (RegionInfo region : unassignedRegions) {
         registerRegion(region, regionIndex, -1, loads, regionFinder);
         regionIndex++;
       }
@@ -378,12 +378,12 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
       }
 
       for (int i = 0; i < regions.length; i ++) {
-        HRegionInfo info = regions[i];
+        RegionInfo info = regions[i];
         if (RegionReplicaUtil.isDefaultReplica(info)) {
           regionIndexToPrimaryIndex[i] = i;
         } else {
           hasRegionReplicas = true;
-          HRegionInfo primaryInfo = RegionReplicaUtil.getRegionInfoForDefaultReplica(info);
+          RegionInfo primaryInfo = RegionReplicaUtil.getRegionInfoForDefaultReplica(info);
           regionIndexToPrimaryIndex[i] = regionsToIndex.getOrDefault(primaryInfo, -1);
         }
       }
@@ -453,7 +453,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
     }
 
     /** Helper for Cluster constructor to handle a region */
-    private void registerRegion(HRegionInfo region, int regionIndex,
+    private void registerRegion(RegionInfo region, int regionIndex,
         int serverIndex, Map<String, Deque<BalancerRegionLoad>> loads,
         RegionLocationFinder regionFinder) {
       String tableName = region.getTable().getNameAsString();
@@ -731,7 +731,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
      * of the region in question
      * @return true or false
      */
-    boolean wouldLowerAvailability(HRegionInfo regionInfo, ServerName serverName) {
+    boolean wouldLowerAvailability(RegionInfo regionInfo, ServerName serverName) {
       if (!serversToIndex.containsKey(serverName.getHostAndPort())) {
         return false; // safeguard against race between cluster.servers and servers from LB method args
       }
@@ -783,7 +783,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
       return false;
     }
 
-    void doAssignRegion(HRegionInfo regionInfo, ServerName serverName) {
+    void doAssignRegion(RegionInfo regionInfo, ServerName serverName) {
       if (!serversToIndex.containsKey(serverName.getHostAndPort())) {
         return;
       }
@@ -1047,20 +1047,20 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
    * Check if a region belongs to some system table.
    * If so, the primary replica may be expected to be put on the master regionserver.
    */
-  public boolean shouldBeOnMaster(HRegionInfo region) {
+  public boolean shouldBeOnMaster(RegionInfo region) {
     return this.onlySystemTablesOnMaster && region.isSystemTable();
   }
 
   /**
    * Balance the regions that should be on master regionserver.
    */
-  protected List<RegionPlan> balanceMasterRegions(Map<ServerName, List<HRegionInfo>> clusterMap) {
+  protected List<RegionPlan> balanceMasterRegions(Map<ServerName, List<RegionInfo>> clusterMap) {
     if (masterServerName == null || clusterMap == null || clusterMap.size() <= 1) return null;
     List<RegionPlan> plans = null;
-    List<HRegionInfo> regions = clusterMap.get(masterServerName);
+    List<RegionInfo> regions = clusterMap.get(masterServerName);
     if (regions != null) {
       Iterator<ServerName> keyIt = null;
-      for (HRegionInfo region: regions) {
+      for (RegionInfo region: regions) {
         if (shouldBeOnMaster(region)) continue;
 
         // Find a non-master regionserver to host the region
@@ -1083,9 +1083,9 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
         plans.add(plan);
       }
     }
-    for (Map.Entry<ServerName, List<HRegionInfo>> server: clusterMap.entrySet()) {
+    for (Map.Entry<ServerName, List<RegionInfo>> server: clusterMap.entrySet()) {
       if (masterServerName.equals(server.getKey())) continue;
-      for (HRegionInfo region: server.getValue()) {
+      for (RegionInfo region: server.getValue()) {
         if (!shouldBeOnMaster(region)) continue;
 
         // Move this region to the master regionserver
@@ -1103,16 +1103,16 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
    * If master is configured to carry system tables only, in here is
    * where we figure what to assign it.
    */
-  protected Map<ServerName, List<HRegionInfo>> assignMasterSystemRegions(
-      Collection<HRegionInfo> regions, List<ServerName> servers) {
+  protected Map<ServerName, List<RegionInfo>> assignMasterSystemRegions(
+      Collection<RegionInfo> regions, List<ServerName> servers) {
     if (servers == null || regions == null || regions.isEmpty()) {
       return null;
     }
-    Map<ServerName, List<HRegionInfo>> assignments = new TreeMap<>();
+    Map<ServerName, List<RegionInfo>> assignments = new TreeMap<>();
     if (this.onlySystemTablesOnMaster) {
       if (masterServerName != null && servers.contains(masterServerName)) {
         assignments.put(masterServerName, new ArrayList<>());
-        for (HRegionInfo region : regions) {
+        for (RegionInfo region : regions) {
           if (shouldBeOnMaster(region)) {
             assignments.get(masterServerName).add(region);
           }
@@ -1136,7 +1136,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
   }
 
   @Override
-  public void setClusterLoad(Map<TableName, Map<ServerName, List<HRegionInfo>>> clusterLoad){
+  public void setClusterLoad(Map<TableName, Map<ServerName, List<RegionInfo>>> clusterLoad){
 
   }
 
@@ -1169,7 +1169,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
     int floor = (int) Math.floor(average * (1 - slop));
     int ceiling = (int) Math.ceil(average * (1 + slop));
     if (!(cs.getMaxLoad() > ceiling || cs.getMinLoad() < floor)) {
-      NavigableMap<ServerAndLoad, List<HRegionInfo>> serversByLoad = cs.getServersByLoad();
+      NavigableMap<ServerAndLoad, List<RegionInfo>> serversByLoad = cs.getServersByLoad();
       if (LOG.isTraceEnabled()) {
         // If nothing to balance, then don't say anything unless trace-level logging.
         LOG.trace("Skipping load balancing because balanced cluster; " +
@@ -1212,15 +1212,15 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
    *         assignment is possible (ie. no regions or no servers)
    */
   @Override
-  public Map<ServerName, List<HRegionInfo>> roundRobinAssignment(List<HRegionInfo> regions,
+  public Map<ServerName, List<RegionInfo>> roundRobinAssignment(List<RegionInfo> regions,
       List<ServerName> servers) throws HBaseIOException {
     metricsBalancer.incrMiscInvocations();
-    Map<ServerName, List<HRegionInfo>> assignments = assignMasterSystemRegions(regions, servers);
+    Map<ServerName, List<RegionInfo>> assignments = assignMasterSystemRegions(regions, servers);
     if (assignments != null && !assignments.isEmpty()) {
       servers = new ArrayList<>(servers);
       // Guarantee not to put other regions on master
       servers.remove(masterServerName);
-      List<HRegionInfo> masterRegions = assignments.get(masterServerName);
+      List<RegionInfo> masterRegions = assignments.get(masterServerName);
       if (!masterRegions.isEmpty()) {
         regions = new ArrayList<>(regions);
         regions.removeAll(masterRegions);
@@ -1248,20 +1248,20 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
     }
 
     Cluster cluster = createCluster(servers, regions, false);
-    List<HRegionInfo> unassignedRegions = new ArrayList<>();
+    List<RegionInfo> unassignedRegions = new ArrayList<>();
 
     roundRobinAssignment(cluster, regions, unassignedRegions,
       servers, assignments);
 
-    List<HRegionInfo> lastFewRegions = new ArrayList<>();
+    List<RegionInfo> lastFewRegions = new ArrayList<>();
     // assign the remaining by going through the list and try to assign to servers one-by-one
     int serverIdx = RANDOM.nextInt(numServers);
-    for (HRegionInfo region : unassignedRegions) {
+    for (RegionInfo region : unassignedRegions) {
       boolean assigned = false;
       for (int j = 0; j < numServers; j++) { // try all servers one by one
         ServerName serverName = servers.get((j + serverIdx) % numServers);
         if (!cluster.wouldLowerAvailability(region, serverName)) {
-          List<HRegionInfo> serverRegions =
+          List<RegionInfo> serverRegions =
               assignments.computeIfAbsent(serverName, k -> new ArrayList<>());
           serverRegions.add(region);
           cluster.doAssignRegion(region, serverName);
@@ -1276,10 +1276,10 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
     }
     // just sprinkle the rest of the regions on random regionservers. The balanceCluster will
     // make it optimal later. we can end up with this if numReplicas > numServers.
-    for (HRegionInfo region : lastFewRegions) {
+    for (RegionInfo region : lastFewRegions) {
       int i = RANDOM.nextInt(numServers);
       ServerName server = servers.get(i);
-      List<HRegionInfo> serverRegions = assignments.computeIfAbsent(server, k -> new ArrayList<>());
+      List<RegionInfo> serverRegions = assignments.computeIfAbsent(server, k -> new ArrayList<>());
       serverRegions.add(region);
       cluster.doAssignRegion(region, server);
     }
@@ -1287,7 +1287,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
   }
 
   protected Cluster createCluster(List<ServerName> servers,
-      Collection<HRegionInfo> regions, boolean forceRefresh) {
+      Collection<RegionInfo> regions, boolean forceRefresh) {
     if (forceRefresh && useRegionFinder) {
       regionFinder.refreshAndWait(regions);
     }
@@ -1295,7 +1295,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
     // a cluster out of it. Note that we might have replicas already assigned to some servers
     // earlier. So we want to get the snapshot to see those assignments, but this will only contain
     // replicas of the regions that are passed (for performance).
-    Map<ServerName, List<HRegionInfo>> clusterState = getRegionAssignmentsByServer(regions);
+    Map<ServerName, List<RegionInfo>> clusterState = getRegionAssignmentsByServer(regions);
 
     for (ServerName server : servers) {
       if (!clusterState.containsKey(server)) {
@@ -1315,7 +1315,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
    * Used to assign a single region to a random server.
    */
   @Override
-  public ServerName randomAssignment(HRegionInfo regionInfo, List<ServerName> servers)
+  public ServerName randomAssignment(RegionInfo regionInfo, List<ServerName> servers)
       throws HBaseIOException {
     metricsBalancer.incrMiscInvocations();
     if (servers != null && servers.contains(masterServerName)) {
@@ -1343,7 +1343,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
     }
     final List<ServerName> finalServers = idleServers.isEmpty() ?
             servers : idleServers;
-    List<HRegionInfo> regions = Lists.newArrayList(regionInfo);
+    List<RegionInfo> regions = Lists.newArrayList(regionInfo);
     Cluster cluster = createCluster(finalServers, regions, false);
     return randomAssignment(cluster, regionInfo, finalServers);
   }
@@ -1366,16 +1366,16 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
    * @return map of servers and regions to be assigned to them
    */
   @Override
-  public Map<ServerName, List<HRegionInfo>> retainAssignment(Map<HRegionInfo, ServerName> regions,
+  public Map<ServerName, List<RegionInfo>> retainAssignment(Map<RegionInfo, ServerName> regions,
       List<ServerName> servers) throws HBaseIOException {
     // Update metrics
     metricsBalancer.incrMiscInvocations();
-    Map<ServerName, List<HRegionInfo>> assignments = assignMasterSystemRegions(regions.keySet(), servers);
+    Map<ServerName, List<RegionInfo>> assignments = assignMasterSystemRegions(regions.keySet(), servers);
     if (assignments != null && !assignments.isEmpty()) {
       servers = new ArrayList<>(servers);
       // Guarantee not to put other regions on master
       servers.remove(masterServerName);
-      List<HRegionInfo> masterRegions = assignments.get(masterServerName);
+      List<RegionInfo> masterRegions = assignments.get(masterServerName);
       regions = regions.entrySet().stream().filter(e -> !masterRegions.contains(e.getKey()))
           .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
     }
@@ -1416,8 +1416,8 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
 
     Cluster cluster = createCluster(servers, regions.keySet(), true);
 
-    for (Map.Entry<HRegionInfo, ServerName> entry : regions.entrySet()) {
-      HRegionInfo region = entry.getKey();
+    for (Map.Entry<RegionInfo, ServerName> entry : regions.entrySet()) {
+      RegionInfo region = entry.getKey();
       ServerName oldServerName = entry.getValue();
       List<ServerName> localServers = new ArrayList<>();
       if (oldServerName != null) {
@@ -1477,11 +1477,11 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
   }
 
   @Override
-  public void regionOnline(HRegionInfo regionInfo, ServerName sn) {
+  public void regionOnline(RegionInfo regionInfo, ServerName sn) {
   }
 
   @Override
-  public void regionOffline(HRegionInfo regionInfo) {
+  public void regionOffline(RegionInfo regionInfo) {
   }
 
   @Override
@@ -1498,7 +1498,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
   /**
    * Used to assign a single region to a random server.
    */
-  private ServerName randomAssignment(Cluster cluster, HRegionInfo regionInfo,
+  private ServerName randomAssignment(Cluster cluster, RegionInfo regionInfo,
       List<ServerName> servers) {
     int numServers = servers.size(); // servers is not null, numServers > 1
     ServerName sn = null;
@@ -1517,9 +1517,9 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
   /**
    * Round robin a list of regions to a list of servers
    */
-  private void roundRobinAssignment(Cluster cluster, List<HRegionInfo> regions,
-      List<HRegionInfo> unassignedRegions, List<ServerName> servers,
-      Map<ServerName, List<HRegionInfo>> assignments) {
+  private void roundRobinAssignment(Cluster cluster, List<RegionInfo> regions,
+      List<RegionInfo> unassignedRegions, List<ServerName> servers,
+      Map<ServerName, List<RegionInfo>> assignments) {
 
     int numServers = servers.size();
     int numRegions = regions.size();
@@ -1532,9 +1532,9 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
 
     for (int j = 0; j < numServers; j++) {
       ServerName server = servers.get((j + serverIdx) % numServers);
-      List<HRegionInfo> serverRegions = new ArrayList<>(max);
+      List<RegionInfo> serverRegions = new ArrayList<>(max);
       for (int i = regionIdx; i < numRegions; i += numServers) {
-        HRegionInfo region = regions.get(i % numRegions);
+        RegionInfo region = regions.get(i % numRegions);
         if (cluster.wouldLowerAvailability(region, server)) {
           unassignedRegions.add(region);
         } else {
@@ -1547,8 +1547,8 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
     }
   }
 
-  protected Map<ServerName, List<HRegionInfo>> getRegionAssignmentsByServer(
-    Collection<HRegionInfo> regions) {
+  protected Map<ServerName, List<RegionInfo>> getRegionAssignmentsByServer(
+    Collection<RegionInfo> regions) {
     if (this.services != null && this.services.getAssignmentManager() != null) {
       return this.services.getAssignmentManager().getSnapShotOfAssignment(regions);
     } else {

http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/ClusterLoadState.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/ClusterLoadState.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/ClusterLoadState.java
index 8c337bd..a783a07 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/ClusterLoadState.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/ClusterLoadState.java
@@ -22,27 +22,27 @@ import java.util.Map;
 import java.util.NavigableMap;
 import java.util.TreeMap;
 
-import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.ServerName;
+import org.apache.hadoop.hbase.client.RegionInfo;
 
 /**
  * Class used to hold the current state of the cluster and how balanced it is.
  */
 public class ClusterLoadState {
-  private final Map<ServerName, List<HRegionInfo>> clusterState;
-  private final NavigableMap<ServerAndLoad, List<HRegionInfo>> serversByLoad;
+  private final Map<ServerName, List<RegionInfo>> clusterState;
+  private final NavigableMap<ServerAndLoad, List<RegionInfo>> serversByLoad;
   private boolean emptyRegionServerPresent = false;
   private int numRegions = 0;
   private int numServers = 0;
 
-  public ClusterLoadState(Map<ServerName, List<HRegionInfo>> clusterState) {
+  public ClusterLoadState(Map<ServerName, List<RegionInfo>> clusterState) {
     this.numRegions = 0;
     this.numServers = clusterState.size();
     this.clusterState = clusterState;
     serversByLoad = new TreeMap<>();
     // Iterate so we can count regions as we build the map
-    for (Map.Entry<ServerName, List<HRegionInfo>> server : clusterState.entrySet()) {
-      List<HRegionInfo> regions = server.getValue();
+    for (Map.Entry<ServerName, List<RegionInfo>> server : clusterState.entrySet()) {
+      List<RegionInfo> regions = server.getValue();
       int sz = regions.size();
       if (sz == 0) emptyRegionServerPresent = true;
       numRegions += sz;
@@ -50,11 +50,11 @@ public class ClusterLoadState {
     }
   }
 
-  Map<ServerName, List<HRegionInfo>> getClusterState() {
+  Map<ServerName, List<RegionInfo>> getClusterState() {
     return clusterState;
   }
 
-  NavigableMap<ServerAndLoad, List<HRegionInfo>> getServersByLoad() {
+  NavigableMap<ServerAndLoad, List<RegionInfo>> getServersByLoad() {
     return serversByLoad;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/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 8dc2a85..a2fe9a2 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
@@ -17,11 +17,11 @@
  */
 package org.apache.hadoop.hbase.master.balancer;
 
+import static org.apache.hadoop.hbase.ServerName.NON_STARTCODE;
 import static org.apache.hadoop.hbase.favored.FavoredNodeAssignmentHelper.FAVORED_NODES_NUM;
 import static org.apache.hadoop.hbase.favored.FavoredNodesPlan.Position.PRIMARY;
 import static org.apache.hadoop.hbase.favored.FavoredNodesPlan.Position.SECONDARY;
 import static org.apache.hadoop.hbase.favored.FavoredNodesPlan.Position.TERTIARY;
-import static org.apache.hadoop.hbase.ServerName.NON_STARTCODE;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -35,9 +35,9 @@ import java.util.Set;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.HBaseIOException;
-import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.ServerLoad;
 import org.apache.hadoop.hbase.ServerName;
+import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.hadoop.hbase.favored.FavoredNodeAssignmentHelper;
 import org.apache.hadoop.hbase.favored.FavoredNodesManager;
 import org.apache.hadoop.hbase.favored.FavoredNodesPlan;
@@ -107,20 +107,20 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements
    * secondary and tertiary as per favored nodes constraints.
    */
   @Override
-  public Map<ServerName, List<HRegionInfo>> roundRobinAssignment(List<HRegionInfo> regions,
+  public Map<ServerName, List<RegionInfo>> roundRobinAssignment(List<RegionInfo> regions,
       List<ServerName> servers) throws HBaseIOException {
 
     metricsBalancer.incrMiscInvocations();
 
-    Set<HRegionInfo> regionSet = Sets.newHashSet(regions);
-    Map<ServerName, List<HRegionInfo>> assignmentMap = assignMasterSystemRegions(regions, servers);
+    Set<RegionInfo> regionSet = Sets.newHashSet(regions);
+    Map<ServerName, List<RegionInfo>> assignmentMap = assignMasterSystemRegions(regions, servers);
     if (assignmentMap != null && !assignmentMap.isEmpty()) {
       servers = new ArrayList<>(servers);
       // Guarantee not to put other regions on master
       servers.remove(masterServerName);
-      List<HRegionInfo> masterRegions = assignmentMap.get(masterServerName);
+      List<RegionInfo> masterRegions = assignmentMap.get(masterServerName);
       if (!masterRegions.isEmpty()) {
-        for (HRegionInfo region: masterRegions) {
+        for (RegionInfo region: masterRegions) {
           regionSet.remove(region);
         }
       }
@@ -135,18 +135,18 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements
           new FavoredNodeAssignmentHelper(servers, fnm.getRackManager());
       helper.initialize();
 
-      Set<HRegionInfo> systemRegions = FavoredNodesManager.filterNonFNApplicableRegions(regionSet);
+      Set<RegionInfo> systemRegions = FavoredNodesManager.filterNonFNApplicableRegions(regionSet);
       regionSet.removeAll(systemRegions);
 
       // Assign all system regions
-      Map<ServerName, List<HRegionInfo>> systemAssignments =
+      Map<ServerName, List<RegionInfo>> systemAssignments =
         super.roundRobinAssignment(Lists.newArrayList(systemRegions), servers);
 
       // Segregate favored and non-favored nodes regions and assign accordingly.
-      Pair<Map<ServerName,List<HRegionInfo>>, List<HRegionInfo>> segregatedRegions =
+      Pair<Map<ServerName,List<RegionInfo>>, List<RegionInfo>> segregatedRegions =
         segregateRegionsAndAssignRegionsWithFavoredNodes(regionSet, servers);
-      Map<ServerName, List<HRegionInfo>> regionsWithFavoredNodesMap = segregatedRegions.getFirst();
-      Map<ServerName, List<HRegionInfo>> regionsWithoutFN =
+      Map<ServerName, List<RegionInfo>> regionsWithFavoredNodesMap = segregatedRegions.getFirst();
+      Map<ServerName, List<RegionInfo>> regionsWithoutFN =
         generateFNForRegionsWithoutFN(helper, segregatedRegions.getSecond());
 
       // merge the assignment maps
@@ -161,16 +161,16 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements
     return assignmentMap;
   }
 
-  private void mergeAssignmentMaps(Map<ServerName, List<HRegionInfo>> assignmentMap,
-      Map<ServerName, List<HRegionInfo>> otherAssignments) {
+  private void mergeAssignmentMaps(Map<ServerName, List<RegionInfo>> assignmentMap,
+      Map<ServerName, List<RegionInfo>> otherAssignments) {
 
     if (otherAssignments == null || otherAssignments.isEmpty()) {
       return;
     }
 
-    for (Entry<ServerName, List<HRegionInfo>> entry : otherAssignments.entrySet()) {
+    for (Entry<ServerName, List<RegionInfo>> entry : otherAssignments.entrySet()) {
       ServerName sn = entry.getKey();
-      List<HRegionInfo> regionsList = entry.getValue();
+      List<RegionInfo> regionsList = entry.getValue();
       if (assignmentMap.get(sn) == null) {
         assignmentMap.put(sn, Lists.newArrayList(regionsList));
       } else {
@@ -179,11 +179,11 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements
     }
   }
 
-  private Map<ServerName, List<HRegionInfo>> generateFNForRegionsWithoutFN(
-      FavoredNodeAssignmentHelper helper, List<HRegionInfo> regions) throws IOException {
+  private Map<ServerName, List<RegionInfo>> generateFNForRegionsWithoutFN(
+      FavoredNodeAssignmentHelper helper, List<RegionInfo> regions) throws IOException {
 
-    Map<ServerName, List<HRegionInfo>> assignmentMap = Maps.newHashMap();
-    Map<HRegionInfo, List<ServerName>> regionsNoFNMap;
+    Map<ServerName, List<RegionInfo>> assignmentMap = Maps.newHashMap();
+    Map<RegionInfo, List<ServerName>> regionsNoFNMap;
 
     if (regions.size() > 0) {
       regionsNoFNMap = helper.generateFavoredNodesRoundRobin(assignmentMap, regions);
@@ -196,16 +196,16 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements
    * Return a pair - one with assignments when favored nodes are present and another with regions
    * without favored nodes.
    */
-  private Pair<Map<ServerName, List<HRegionInfo>>, List<HRegionInfo>>
-  segregateRegionsAndAssignRegionsWithFavoredNodes(Collection<HRegionInfo> regions,
+  private Pair<Map<ServerName, List<RegionInfo>>, List<RegionInfo>>
+  segregateRegionsAndAssignRegionsWithFavoredNodes(Collection<RegionInfo> regions,
       List<ServerName> onlineServers) throws HBaseIOException {
 
     // Since we expect FN to be present most of the time, lets create map with same size
-    Map<ServerName, List<HRegionInfo>> assignmentMapForFavoredNodes =
+    Map<ServerName, List<RegionInfo>> assignmentMapForFavoredNodes =
         new HashMap<>(onlineServers.size());
-    List<HRegionInfo> regionsWithNoFavoredNodes = new ArrayList<>();
+    List<RegionInfo> regionsWithNoFavoredNodes = new ArrayList<>();
 
-    for (HRegionInfo region : regions) {
+    for (RegionInfo region : regions) {
       List<ServerName> favoredNodes = fnm.getFavoredNodes(region);
       ServerName primaryHost = null;
       ServerName secondaryHost = null;
@@ -235,10 +235,10 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements
     return new Pair<>(assignmentMapForFavoredNodes, regionsWithNoFavoredNodes);
   }
 
-  private void addRegionToMap(Map<ServerName, List<HRegionInfo>> assignmentMapForFavoredNodes,
-      HRegionInfo region, ServerName host) {
+  private void addRegionToMap(Map<ServerName, List<RegionInfo>> assignmentMapForFavoredNodes,
+      RegionInfo region, ServerName host) {
 
-    List<HRegionInfo> regionsOnServer;
+    List<RegionInfo> regionsOnServer;
     if ((regionsOnServer = assignmentMapForFavoredNodes.get(host)) == null) {
       regionsOnServer = Lists.newArrayList();
       assignmentMapForFavoredNodes.put(host, regionsOnServer);
@@ -265,7 +265,7 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements
    * available (in that order).
    */
   private void assignRegionToAvailableFavoredNode(
-      Map<ServerName, List<HRegionInfo>> assignmentMapForFavoredNodes, HRegionInfo region,
+      Map<ServerName, List<RegionInfo>> assignmentMapForFavoredNodes, RegionInfo region,
       ServerName primaryHost, ServerName secondaryHost, ServerName tertiaryHost) {
 
     if (primaryHost != null) {
@@ -304,7 +304,7 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements
    * destination. If we can't generate anything, lets fallback.
    */
   @Override
-  public ServerName randomAssignment(HRegionInfo regionInfo, List<ServerName> servers)
+  public ServerName randomAssignment(RegionInfo regionInfo, List<ServerName> servers)
       throws HBaseIOException {
 
     if (servers != null && servers.contains(masterServerName)) {
@@ -354,9 +354,9 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements
     return destination;
   }
 
-  private void updateFavoredNodesForRegion(HRegionInfo regionInfo, List<ServerName> newFavoredNodes)
+  private void updateFavoredNodesForRegion(RegionInfo regionInfo, List<ServerName> newFavoredNodes)
       throws IOException {
-    Map<HRegionInfo, List<ServerName>> regionFNMap = Maps.newHashMap();
+    Map<RegionInfo, List<ServerName>> regionFNMap = Maps.newHashMap();
     regionFNMap.put(regionInfo, newFavoredNodes);
     fnm.updateFavoredNodes(regionFNMap);
   }
@@ -365,11 +365,11 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements
    * Reuse BaseLoadBalancer's retainAssignment, but generate favored nodes when its missing.
    */
   @Override
-  public Map<ServerName, List<HRegionInfo>> retainAssignment(Map<HRegionInfo, ServerName> regions,
+  public Map<ServerName, List<RegionInfo>> retainAssignment(Map<RegionInfo, ServerName> regions,
       List<ServerName> servers) throws HBaseIOException {
 
-    Map<ServerName, List<HRegionInfo>> assignmentMap = Maps.newHashMap();
-    Map<ServerName, List<HRegionInfo>> result = super.retainAssignment(regions, servers);
+    Map<ServerName, List<RegionInfo>> assignmentMap = Maps.newHashMap();
+    Map<ServerName, List<RegionInfo>> result = super.retainAssignment(regions, servers);
     if (result == null || result.isEmpty()) {
       LOG.warn("Nothing to assign to, probably no servers or no regions");
       return null;
@@ -386,15 +386,15 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements
     helper.initialize();
 
     LOG.debug("Generating favored nodes for regions missing them.");
-    Map<HRegionInfo, List<ServerName>> regionFNMap = Maps.newHashMap();
+    Map<RegionInfo, List<ServerName>> regionFNMap = Maps.newHashMap();
 
     try {
-      for (Entry<ServerName, List<HRegionInfo>> entry : result.entrySet()) {
+      for (Entry<ServerName, List<RegionInfo>> entry : result.entrySet()) {
 
         ServerName sn = entry.getKey();
         ServerName primary = ServerName.valueOf(sn.getHostname(), sn.getPort(), NON_STARTCODE);
 
-        for (HRegionInfo hri : entry.getValue()) {
+        for (RegionInfo hri : entry.getValue()) {
 
           if (FavoredNodesManager.isFavoredNodeApplicable(hri)) {
             List<ServerName> favoredNodes = fnm.getFavoredNodes(hri);
@@ -472,7 +472,7 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements
     }
   }
 
-  public synchronized List<ServerName> getFavoredNodes(HRegionInfo regionInfo) {
+  public synchronized List<ServerName> getFavoredNodes(RegionInfo regionInfo) {
     return this.fnm.getFavoredNodes(regionInfo);
   }
 
@@ -487,10 +487,10 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements
    * randomly. This would give us better distribution over a period of time after enough splits.
    */
   @Override
-  public void generateFavoredNodesForDaughter(List<ServerName> servers, HRegionInfo parent,
-      HRegionInfo regionA, HRegionInfo regionB) throws IOException {
+  public void generateFavoredNodesForDaughter(List<ServerName> servers, RegionInfo parent,
+      RegionInfo regionA, RegionInfo regionB) throws IOException {
 
-    Map<HRegionInfo, List<ServerName>> result = new HashMap<>();
+    Map<RegionInfo, List<ServerName>> result = new HashMap<>();
     FavoredNodeAssignmentHelper helper = new FavoredNodeAssignmentHelper(servers, rackManager);
     helper.initialize();
 
@@ -542,8 +542,8 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements
    * keep it simple.
    */
   @Override
-  public void generateFavoredNodesForMergedRegion(HRegionInfo merged, HRegionInfo regionA,
-      HRegionInfo regionB) throws IOException {
+  public void generateFavoredNodesForMergedRegion(RegionInfo merged, RegionInfo regionA,
+      RegionInfo regionB) throws IOException {
     updateFavoredNodesForRegion(merged, fnm.getFavoredNodes(regionA));
   }
 
@@ -572,7 +572,7 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements
         return Cluster.NullAction;
       }
 
-      HRegionInfo hri = cluster.regions[thisRegion];
+      RegionInfo hri = cluster.regions[thisRegion];
       List<ServerName> favoredNodes = fnm.getFavoredNodes(hri);
       int otherServer;
       if (favoredNodes == null) {
@@ -628,7 +628,7 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements
       cluster.sortServersByRegionCount();
       int thisServer = pickMostLoadedServer(cluster);
       int thisRegion = pickRandomRegion(cluster, thisServer, 0);
-      HRegionInfo hri = cluster.regions[thisRegion];
+      RegionInfo hri = cluster.regions[thisRegion];
       int otherServer;
       List<ServerName> favoredNodes = fnm.getFavoredNodes(hri);
       if (favoredNodes == null) {
@@ -693,20 +693,20 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements
    * implementation. For the misplaced regions, we assign a bogus server to it and AM takes care.
    */
   @Override
-  public List<RegionPlan> balanceCluster(Map<ServerName, List<HRegionInfo>> clusterState) {
+  public List<RegionPlan> balanceCluster(Map<ServerName, List<RegionInfo>> clusterState) {
 
     if (this.services != null) {
 
       List<RegionPlan> regionPlans = Lists.newArrayList();
-      Map<ServerName, List<HRegionInfo>> correctAssignments = new HashMap<>();
+      Map<ServerName, List<RegionInfo>> correctAssignments = new HashMap<>();
       int misplacedRegions = 0;
 
-      for (Entry<ServerName, List<HRegionInfo>> entry : clusterState.entrySet()) {
+      for (Entry<ServerName, List<RegionInfo>> entry : clusterState.entrySet()) {
         ServerName current = entry.getKey();
-        List<HRegionInfo> regions = Lists.newArrayList();
+        List<RegionInfo> regions = Lists.newArrayList();
         correctAssignments.put(current, regions);
 
-        for (HRegionInfo hri : entry.getValue()) {
+        for (RegionInfo hri : entry.getValue()) {
           List<ServerName> favoredNodes = fnm.getFavoredNodes(hri);
           if (FavoredNodesPlan.getFavoredServerPosition(favoredNodes, current) != null ||
               !FavoredNodesManager.isFavoredNodeApplicable(hri)) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionInfoComparator.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionInfoComparator.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionInfoComparator.java
index 51d8c88..911b70b 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionInfoComparator.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionInfoComparator.java
@@ -19,7 +19,7 @@ package org.apache.hadoop.hbase.master.balancer;
 
 import java.util.Comparator;
 
-import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.client.RegionInfo;
 
 /**
  * The following comparator assumes that RegionId from HRegionInfo can represent
@@ -27,9 +27,9 @@ import org.apache.hadoop.hbase.HRegionInfo;
  * comparator is used in balanceCluster() to account for the out-of-band regions
  * which were assigned to the server after some other region server crashed.
  */
-class RegionInfoComparator implements Comparator<HRegionInfo> {
+class RegionInfoComparator implements Comparator<RegionInfo> {
   @Override
-  public int compare(HRegionInfo l, HRegionInfo r) {
+  public int compare(RegionInfo l, RegionInfo r) {
     long diff = r.getRegionId() - l.getRegionId();
     if (diff < 0) return -1;
     if (diff > 0) return 1;

http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionLocationFinder.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionLocationFinder.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionLocationFinder.java
index 6f56454..f5502cc 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionLocationFinder.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionLocationFinder.java
@@ -33,15 +33,15 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.ClusterStatus;
 import org.apache.hadoop.hbase.HDFSBlocksDistribution;
-import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
-import org.apache.yetus.audience.InterfaceAudience;
+import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.hadoop.hbase.client.TableDescriptor;
-import org.apache.hadoop.hbase.master.assignment.AssignmentManager;
 import org.apache.hadoop.hbase.master.MasterServices;
+import org.apache.hadoop.hbase.master.assignment.AssignmentManager;
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
 
 import org.apache.hadoop.hbase.shaded.com.google.common.cache.CacheBuilder;
 import org.apache.hadoop.hbase.shaded.com.google.common.cache.CacheLoader;
@@ -71,10 +71,10 @@ class RegionLocationFinder {
   // Do not scheduleFullRefresh at master startup
   private long lastFullRefresh = EnvironmentEdgeManager.currentTime();
 
-  private CacheLoader<HRegionInfo, HDFSBlocksDistribution> loader =
-      new CacheLoader<HRegionInfo, HDFSBlocksDistribution>() {
+  private CacheLoader<RegionInfo, HDFSBlocksDistribution> loader =
+      new CacheLoader<RegionInfo, HDFSBlocksDistribution>() {
 
-        public ListenableFuture<HDFSBlocksDistribution> reload(final HRegionInfo hri,
+        public ListenableFuture<HDFSBlocksDistribution> reload(final RegionInfo hri,
                HDFSBlocksDistribution oldValue) throws Exception {
           return executor.submit(new Callable<HDFSBlocksDistribution>() {
             @Override
@@ -85,13 +85,13 @@ class RegionLocationFinder {
         }
 
         @Override
-        public HDFSBlocksDistribution load(HRegionInfo key) throws Exception {
+        public HDFSBlocksDistribution load(RegionInfo key) throws Exception {
           return internalGetTopBlockLocation(key);
         }
       };
 
   // The cache for where regions are located.
-  private LoadingCache<HRegionInfo, HDFSBlocksDistribution> cache = null;
+  private LoadingCache<RegionInfo, HDFSBlocksDistribution> cache = null;
 
   RegionLocationFinder() {
     this.cache = createCache();
@@ -109,7 +109,7 @@ class RegionLocationFinder {
    * @param time time to cache the locations
    * @return A new Cache.
    */
-  private LoadingCache<HRegionInfo, HDFSBlocksDistribution> createCache() {
+  private LoadingCache<RegionInfo, HDFSBlocksDistribution> createCache() {
     return CacheBuilder.newBuilder()
         .expireAfterWrite(CACHE_TIME, TimeUnit.MILLISECONDS)
         .build(loader);
@@ -155,14 +155,14 @@ class RegionLocationFinder {
 
     // TODO: Should this refresh all the regions or only the ones assigned?
     boolean includesUserTables = false;
-    for (final HRegionInfo hri : am.getAssignedRegions()) {
+    for (final RegionInfo hri : am.getAssignedRegions()) {
       cache.refresh(hri);
       includesUserTables = includesUserTables || !hri.isSystemTable();
     }
     return includesUserTables;
   }
 
-  protected List<ServerName> getTopBlockLocations(HRegionInfo region) {
+  protected List<ServerName> getTopBlockLocations(RegionInfo region) {
     List<String> topHosts = getBlockDistribution(region).getTopHosts();
     return mapHostNameToServerName(topHosts);
   }
@@ -171,7 +171,7 @@ class RegionLocationFinder {
    * Returns an ordered list of hosts which have better locality for this region
    * than the current host.
    */
-  protected List<ServerName> getTopBlockLocations(HRegionInfo region, String currentHost) {
+  protected List<ServerName> getTopBlockLocations(RegionInfo region, String currentHost) {
     HDFSBlocksDistribution blocksDistribution = getBlockDistribution(region);
     List<String> topHosts = new ArrayList<>();
     for (String host : blocksDistribution.getTopHosts()) {
@@ -192,7 +192,7 @@ class RegionLocationFinder {
    * @param region region
    * @return ordered list of hosts holding blocks of the specified region
    */
-  protected HDFSBlocksDistribution internalGetTopBlockLocation(HRegionInfo region) {
+  protected HDFSBlocksDistribution internalGetTopBlockLocation(RegionInfo region) {
     try {
       TableDescriptor tableDescriptor = getTableDescriptor(region.getTable());
       if (tableDescriptor != null) {
@@ -272,7 +272,7 @@ class RegionLocationFinder {
     return topServerNames;
   }
 
-  public HDFSBlocksDistribution getBlockDistribution(HRegionInfo hri) {
+  public HDFSBlocksDistribution getBlockDistribution(RegionInfo hri) {
     HDFSBlocksDistribution blockDistbn = null;
     try {
       if (cache.asMap().containsKey(hri)) {
@@ -294,7 +294,7 @@ class RegionLocationFinder {
   }
 
   private ListenableFuture<HDFSBlocksDistribution> asyncGetBlockDistribution(
-      HRegionInfo hri) {
+      RegionInfo hri) {
     try {
       return loader.reload(hri, EMPTY_BLOCK_DISTRIBUTION);
     } catch (Exception e) {
@@ -302,13 +302,13 @@ class RegionLocationFinder {
     }
   }
 
-  public void refreshAndWait(Collection<HRegionInfo> hris) {
+  public void refreshAndWait(Collection<RegionInfo> hris) {
     ArrayList<ListenableFuture<HDFSBlocksDistribution>> regionLocationFutures = new ArrayList<>(hris.size());
-    for (HRegionInfo hregionInfo : hris) {
+    for (RegionInfo hregionInfo : hris) {
       regionLocationFutures.add(asyncGetBlockDistribution(hregionInfo));
     }
     int index = 0;
-    for (HRegionInfo hregionInfo : hris) {
+    for (RegionInfo hregionInfo : hris) {
       ListenableFuture<HDFSBlocksDistribution> future = regionLocationFutures
           .get(index);
       try {
@@ -325,7 +325,7 @@ class RegionLocationFinder {
   }
 
   // For test
-  LoadingCache<HRegionInfo, HDFSBlocksDistribution> getCache() {
+  LoadingCache<RegionInfo, HDFSBlocksDistribution> getCache() {
     return cache;
   }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java
index b6160c6..e356942 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java
@@ -33,12 +33,12 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseIOException;
 import org.apache.hadoop.hbase.HBaseInterfaceAudience;
-import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
-import org.apache.yetus.audience.InterfaceAudience;
+import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.hadoop.hbase.master.RegionPlan;
 import org.apache.hadoop.hbase.util.Pair;
+import org.apache.yetus.audience.InterfaceAudience;
 
 import org.apache.hadoop.hbase.shaded.com.google.common.collect.MinMaxPriorityQueue;
 
@@ -77,9 +77,9 @@ public class SimpleLoadBalancer extends BaseLoadBalancer {
 
     private int nextRegionForUnload;
     private int numRegionsAdded;
-    private List<HRegionInfo> hriList;
+    private List<RegionInfo> hriList;
 
-    public BalanceInfo(int nextRegionForUnload, int numRegionsAdded, List<HRegionInfo> hriList) {
+    public BalanceInfo(int nextRegionForUnload, int numRegionsAdded, List<RegionInfo> hriList) {
       this.nextRegionForUnload = nextRegionForUnload;
       this.numRegionsAdded = numRegionsAdded;
       this.hriList = hriList;
@@ -97,7 +97,7 @@ public class SimpleLoadBalancer extends BaseLoadBalancer {
       this.numRegionsAdded = numAdded;
     }
 
-    List<HRegionInfo> getHriList() {
+    List<RegionInfo> getHriList() {
       return hriList;
     }
 
@@ -107,11 +107,11 @@ public class SimpleLoadBalancer extends BaseLoadBalancer {
 
   }
 
-  public void setClusterLoad(Map<TableName, Map<ServerName, List<HRegionInfo>>> clusterLoad){
+  public void setClusterLoad(Map<TableName, Map<ServerName, List<RegionInfo>>> clusterLoad){
     serverLoadList = new ArrayList<>();
     float sum = 0;
-    for(Map.Entry<TableName, Map<ServerName, List<HRegionInfo>>> clusterEntry : clusterLoad.entrySet()){
-      for(Map.Entry<ServerName, List<HRegionInfo>> entry : clusterEntry.getValue().entrySet()){
+    for(Map.Entry<TableName, Map<ServerName, List<RegionInfo>>> clusterEntry : clusterLoad.entrySet()){
+      for(Map.Entry<ServerName, List<RegionInfo>> entry : clusterEntry.getValue().entrySet()){
         if(entry.getKey().equals(masterServerName)) continue; // we shouldn't include master as potential assignee
         serverLoadList.add(new ServerAndLoad(entry.getKey(), entry.getValue().size()));
         sum += entry.getValue().size();
@@ -245,7 +245,7 @@ public class SimpleLoadBalancer extends BaseLoadBalancer {
    */
   @Override
   public List<RegionPlan> balanceCluster(
-      Map<ServerName, List<HRegionInfo>> clusterMap) {
+      Map<ServerName, List<RegionInfo>> clusterMap) {
     List<RegionPlan> regionsToReturn = balanceMasterRegions(clusterMap);
     if (regionsToReturn != null || clusterMap == null || clusterMap.size() <= 1) {
       return regionsToReturn;
@@ -267,7 +267,7 @@ public class SimpleLoadBalancer extends BaseLoadBalancer {
 
     ClusterLoadState cs = new ClusterLoadState(clusterMap);
     int numServers = cs.getNumServers();
-    NavigableMap<ServerAndLoad, List<HRegionInfo>> serversByLoad = cs.getServersByLoad();
+    NavigableMap<ServerAndLoad, List<RegionInfo>> serversByLoad = cs.getServersByLoad();
     int numRegions = cs.getNumRegions();
     float average = cs.getLoadAverage();
     int max = (int)Math.ceil(average);
@@ -291,7 +291,7 @@ public class SimpleLoadBalancer extends BaseLoadBalancer {
     // flag used to fetch regions from head and tail of list, alternately
     boolean fetchFromTail = false;
     Map<ServerName, BalanceInfo> serverBalanceInfo = new TreeMap<>();
-    for (Map.Entry<ServerAndLoad, List<HRegionInfo>> server:
+    for (Map.Entry<ServerAndLoad, List<RegionInfo>> server:
         serversByLoad.descendingMap().entrySet()) {
       ServerAndLoad sal = server.getKey();
       int load = sal.getLoad();
@@ -300,14 +300,14 @@ public class SimpleLoadBalancer extends BaseLoadBalancer {
         continue;
       }
       serversOverloaded++;
-      List<HRegionInfo> regions = server.getValue();
+      List<RegionInfo> regions = server.getValue();
       int numToOffload = Math.min(load - max, regions.size());
       // account for the out-of-band regions which were assigned to this server
       // after some other region server crashed
       Collections.sort(regions, riComparator);
       int numTaken = 0;
       for (int i = 0; i <= numToOffload; ) {
-        HRegionInfo hri = regions.get(i); // fetch from head
+        RegionInfo hri = regions.get(i); // fetch from head
         if (fetchFromTail) {
           hri = regions.get(regions.size() - 1 - i);
         }
@@ -330,7 +330,7 @@ public class SimpleLoadBalancer extends BaseLoadBalancer {
 
     Map<ServerName, Integer> underloadedServers = new HashMap<>();
     int maxToTake = numRegions - min;
-    for (Map.Entry<ServerAndLoad, List<HRegionInfo>> server:
+    for (Map.Entry<ServerAndLoad, List<RegionInfo>> server:
         serversByLoad.entrySet()) {
       if (maxToTake == 0) break; // no more to take
       int load = server.getKey().getLoad();
@@ -378,14 +378,14 @@ public class SimpleLoadBalancer extends BaseLoadBalancer {
     // If we need more to fill min, grab one from each most loaded until enough
     if (neededRegions != 0) {
       // Walk down most loaded, grabbing one from each until we get enough
-      for (Map.Entry<ServerAndLoad, List<HRegionInfo>> server :
+      for (Map.Entry<ServerAndLoad, List<RegionInfo>> server :
         serversByLoad.descendingMap().entrySet()) {
         BalanceInfo balanceInfo =
           serverBalanceInfo.get(server.getKey().getServerName());
         int idx =
           balanceInfo == null ? 0 : balanceInfo.getNextRegionForUnload();
         if (idx >= server.getValue().size()) break;
-        HRegionInfo region = server.getValue().get(idx);
+        RegionInfo region = server.getValue().get(idx);
         if (region.isMetaRegion()) continue; // Don't move meta regions.
         regionsToMove.add(new RegionPlan(region, server.getKey().getServerName(), null));
         balanceInfo.setNumRegionsAdded(balanceInfo.getNumRegionsAdded() - 1);
@@ -402,7 +402,7 @@ public class SimpleLoadBalancer extends BaseLoadBalancer {
     // Assign each underloaded up to the min, then if leftovers, assign to max
 
     // Walk down least loaded, assigning to each to fill up to min
-    for (Map.Entry<ServerAndLoad, List<HRegionInfo>> server :
+    for (Map.Entry<ServerAndLoad, List<RegionInfo>> server :
         serversByLoad.entrySet()) {
       int regionCount = server.getKey().getLoad();
       if (regionCount >= min) break;
@@ -434,7 +434,7 @@ public class SimpleLoadBalancer extends BaseLoadBalancer {
         ", numServers=" + numServers + ", serversOverloaded=" + serversOverloaded +
         ", serversUnderloaded=" + serversUnderloaded);
       StringBuilder sb = new StringBuilder();
-      for (Map.Entry<ServerName, List<HRegionInfo>> e: clusterMap.entrySet()) {
+      for (Map.Entry<ServerName, List<RegionInfo>> e: clusterMap.entrySet()) {
         if (sb.length() > 0) sb.append(", ");
         sb.append(e.getKey().toString());
         sb.append(" ");
@@ -481,10 +481,10 @@ public class SimpleLoadBalancer extends BaseLoadBalancer {
       BalanceInfo balanceInfo = serverBalanceInfo.get(serverload.getServerName());
       setLoad(serverLoadList, i, balanceInfo.getNumRegionsAdded());
       if (balanceInfo.getHriList().size() + balanceInfo.getNumRegionsAdded() == max) {
-        HRegionInfo hriToPlan;
+        RegionInfo hriToPlan;
         if (balanceInfo.getHriList().isEmpty()) {
           LOG.debug("During balanceOverall, we found " + serverload.getServerName()
-                  + " has no HRegionInfo, no operation needed");
+                  + " has no RegionInfo, no operation needed");
           continue;
         } else if (balanceInfo.getNextRegionForUnload() >= balanceInfo.getHriList().size()) {
           continue;
@@ -587,7 +587,7 @@ public class SimpleLoadBalancer extends BaseLoadBalancer {
 
   @Override
   public List<RegionPlan> balanceCluster(TableName tableName,
-      Map<ServerName, List<HRegionInfo>> clusterState) throws HBaseIOException {
+      Map<ServerName, List<RegionInfo>> clusterState) throws HBaseIOException {
     LOG.debug("Start Generate Balance plan for table: " + tableName);
     return balanceCluster(clusterState);
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
index 957c182..258f68a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java
@@ -17,8 +17,6 @@
  */
 package org.apache.hadoop.hbase.master.balancer;
 
-import com.google.common.annotations.VisibleForTesting;
-
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -38,11 +36,11 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.ClusterStatus;
 import org.apache.hadoop.hbase.HBaseInterfaceAudience;
 import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.RegionLoad;
 import org.apache.hadoop.hbase.ServerLoad;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.hadoop.hbase.master.MasterServices;
 import org.apache.hadoop.hbase.master.RegionPlan;
 import org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer.Cluster.Action;
@@ -58,6 +56,8 @@ import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.hadoop.hbase.shaded.com.google.common.base.Optional;
 import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
 
+import com.google.common.annotations.VisibleForTesting;
+
 /**
  * <p>This is a best effort load balancer. Given a Cost function F(C) =&gt; x It will
  * randomly try and mutate the cluster to Cprime. If F(Cprime) &lt; F(C) then the
@@ -315,7 +315,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
 
   @Override
   public synchronized List<RegionPlan> balanceCluster(TableName tableName, Map<ServerName,
-    List<HRegionInfo>> clusterState) {
+    List<RegionInfo>> clusterState) {
     this.tableName = tableName;
     return balanceCluster(clusterState);
   }
@@ -332,7 +332,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
    */
   @Override
   public synchronized List<RegionPlan> balanceCluster(Map<ServerName,
-    List<HRegionInfo>> clusterState) {
+    List<RegionInfo>> clusterState) {
     List<RegionPlan> plans = balanceMasterRegions(clusterState);
     if (plans != null || clusterState == null || clusterState.size() <= 1) {
       return plans;
@@ -504,7 +504,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
       int newServerIndex = cluster.regionIndexToServerIndex[regionIndex];
 
       if (initialServerIndex != newServerIndex) {
-        HRegionInfo region = cluster.regions[regionIndex];
+        RegionInfo region = cluster.regions[regionIndex];
         ServerName initialServer = cluster.servers[initialServerIndex];
         ServerName newServer = cluster.servers[newServerIndex];
 
@@ -624,7 +624,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
      * @param server         index of the server
      * @param chanceOfNoSwap Chance that this will decide to try a move rather
      *                       than a swap.
-     * @return a random {@link HRegionInfo} or null if an asymmetrical move is
+     * @return a random {@link RegionInfo} or null if an asymmetrical move is
      *         suggested.
      */
     protected int pickRandomRegion(Cluster cluster, int server, double chanceOfNoSwap) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/master/locking/LockManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/locking/LockManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/locking/LockManager.java
index 9870add..883d659 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/locking/LockManager.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/locking/LockManager.java
@@ -24,13 +24,14 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.TableName;
-import org.apache.yetus.audience.InterfaceAudience;
+import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.hadoop.hbase.master.HMaster;
 import org.apache.hadoop.hbase.procedure2.LockType;
-import org.apache.hadoop.hbase.shaded.com.google.common.annotations.VisibleForTesting;
 import org.apache.hadoop.hbase.util.NonceKey;
+import org.apache.yetus.audience.InterfaceAudience;
+
+import org.apache.hadoop.hbase.shaded.com.google.common.annotations.VisibleForTesting;
 
 /**
  * Functions to acquire lock on table/namespace/regions.
@@ -60,7 +61,7 @@ public final class LockManager {
     return new MasterLock(tableName, type, description);
   }
 
-  public MasterLock createMasterLock(final HRegionInfo[] regionInfos, final String description) {
+  public MasterLock createMasterLock(final RegionInfo[] regionInfos, final String description) {
     return new MasterLock(regionInfos, description);
   }
 
@@ -81,7 +82,7 @@ public final class LockManager {
   public class MasterLock {
     private final String namespace;
     private final TableName tableName;
-    private final HRegionInfo[] regionInfos;
+    private final RegionInfo[] regionInfos;
     private final LockType type;
     private final String description;
 
@@ -105,7 +106,7 @@ public final class LockManager {
       this.description = description;
     }
 
-    public MasterLock(final HRegionInfo[] regionInfos, final String description) {
+    public MasterLock(final RegionInfo[] regionInfos, final String description) {
       this.namespace = null;
       this.tableName = null;
       this.regionInfos = regionInfos;
@@ -229,7 +230,7 @@ public final class LockManager {
     /**
      * @throws IllegalArgumentException if all regions are not from same table.
      */
-    public long requestRegionsLock(final HRegionInfo[] regionInfos, final String description,
+    public long requestRegionsLock(final RegionInfo[] regionInfos, final String description,
         final NonceKey nonceKey)
     throws IllegalArgumentException, IOException {
       master.getMasterCoprocessorHost().preRequestLock(null, null, regionInfos,

http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/master/locking/LockProcedure.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/locking/LockProcedure.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/locking/LockProcedure.java
index ccb3d48..c9b8ef9 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/locking/LockProcedure.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/locking/LockProcedure.java
@@ -19,12 +19,16 @@
 
 package org.apache.hadoop.hbase.master.locking;
 
+import java.io.IOException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.TableName;
-import org.apache.yetus.audience.InterfaceAudience;
+import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv;
 import org.apache.hadoop.hbase.master.procedure.TableProcedureInterface;
 import org.apache.hadoop.hbase.procedure2.LockType;
@@ -32,16 +36,13 @@ import org.apache.hadoop.hbase.procedure2.Procedure;
 import org.apache.hadoop.hbase.procedure2.ProcedureEvent;
 import org.apache.hadoop.hbase.procedure2.ProcedureStateSerializer;
 import org.apache.hadoop.hbase.procedure2.ProcedureSuspendedException;
+import org.apache.yetus.audience.InterfaceAudience;
+
 import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos.LockProcedureData;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos;
 
-import java.io.IOException;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-
 /**
  * Procedure to allow blessed clients and external admin tools to take our internal Schema locks
  * used by the procedure framework isolating procedures doing creates/deletes etc. on
@@ -68,7 +69,7 @@ public final class LockProcedure extends Procedure<MasterProcedureEnv>
 
   private String namespace;
   private TableName tableName;
-  private HRegionInfo[] regionInfos;
+  private RegionInfo[] regionInfos;
   private LockType type;
   // underlying namespace/table/region lock.
   private LockInterface lock;
@@ -160,12 +161,12 @@ public final class LockProcedure extends Procedure<MasterProcedureEnv>
    *                        Useful for locks acquired locally from master process.
    * @throws IllegalArgumentException if all regions are not from same table.
    */
-  public LockProcedure(final Configuration conf, final HRegionInfo[] regionInfos,
+  public LockProcedure(final Configuration conf, final RegionInfo[] regionInfos,
       final LockType type, final String description, final CountDownLatch lockAcquireLatch)
       throws IllegalArgumentException {
     this(conf, type, description, lockAcquireLatch);
 
-    // Build HRegionInfo from region names.
+    // Build RegionInfo from region names.
     if (regionInfos.length == 0) {
       throw new IllegalArgumentException("No regions specified for region lock");
     }
@@ -269,7 +270,7 @@ public final class LockProcedure extends Procedure<MasterProcedureEnv>
           .setDescription(description);
     if (regionInfos != null) {
       for (int i = 0; i < regionInfos.length; ++i) {
-        builder.addRegionInfo(HRegionInfo.convert(regionInfos[i]));
+        builder.addRegionInfo(ProtobufUtil.toRegionInfo(regionInfos[i]));
       }
     } else if (namespace != null) {
       builder.setNamespace(namespace);
@@ -289,9 +290,9 @@ public final class LockProcedure extends Procedure<MasterProcedureEnv>
     type = LockType.valueOf(state.getLockType().name());
     description = state.getDescription();
     if (state.getRegionInfoCount() > 0) {
-      regionInfos = new HRegionInfo[state.getRegionInfoCount()];
+      regionInfos = new RegionInfo[state.getRegionInfoCount()];
       for (int i = 0; i < state.getRegionInfoCount(); ++i) {
-        regionInfos[i] = HRegionInfo.convert(state.getRegionInfo(i));
+        regionInfos[i] = ProtobufUtil.toRegionInfo(state.getRegionInfo(i));
       }
     } else if (state.hasNamespace()) {
       namespace = state.getNamespace();

http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/MergeNormalizationPlan.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/MergeNormalizationPlan.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/MergeNormalizationPlan.java
index ec63e2d..b6602b1 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/MergeNormalizationPlan.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/MergeNormalizationPlan.java
@@ -18,14 +18,13 @@
  */
 package org.apache.hadoop.hbase.master.normalizer;
 
+import java.io.IOException;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.master.normalizer.NormalizationPlan.PlanType;
-
-import java.io.IOException;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.yetus.audience.InterfaceAudience;
 
 /**
  * Normalization plan to merge regions (smallest region in the table with its smallest neighbor).
@@ -34,10 +33,10 @@ import java.io.IOException;
 public class MergeNormalizationPlan implements NormalizationPlan {
   private static final Log LOG = LogFactory.getLog(MergeNormalizationPlan.class.getName());
 
-  private final HRegionInfo firstRegion;
-  private final HRegionInfo secondRegion;
+  private final RegionInfo firstRegion;
+  private final RegionInfo secondRegion;
 
-  public MergeNormalizationPlan(HRegionInfo firstRegion, HRegionInfo secondRegion) {
+  public MergeNormalizationPlan(RegionInfo firstRegion, RegionInfo secondRegion) {
     this.firstRegion = firstRegion;
     this.secondRegion = secondRegion;
   }
@@ -47,11 +46,11 @@ public class MergeNormalizationPlan implements NormalizationPlan {
     return PlanType.MERGE;
   }
 
-  HRegionInfo getFirstRegion() {
+  RegionInfo getFirstRegion() {
     return firstRegion;
   }
 
-  HRegionInfo getSecondRegion() {
+  RegionInfo getSecondRegion() {
     return secondRegion;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/RegionNormalizer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/RegionNormalizer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/RegionNormalizer.java
index fad8db6..74edd26 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/RegionNormalizer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/RegionNormalizer.java
@@ -21,12 +21,12 @@ package org.apache.hadoop.hbase.master.normalizer;
 import java.util.List;
 
 import org.apache.hadoop.hbase.HBaseIOException;
-import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.TableName;
-import org.apache.yetus.audience.InterfaceAudience;
+import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.hadoop.hbase.master.MasterRpcServices;
 import org.apache.hadoop.hbase.master.MasterServices;
 import org.apache.hadoop.hbase.master.normalizer.NormalizationPlan.PlanType;
+import org.apache.yetus.audience.InterfaceAudience;
 
 /**
  * Performs "normalization" of regions on the cluster, making sure that suboptimal
@@ -68,8 +68,8 @@ public interface RegionNormalizer {
    * @param hri the region which is involved in the plan
    * @param type type of plan
    */
-  void planSkipped(HRegionInfo hri, PlanType type);
-  
+  void planSkipped(RegionInfo hri, PlanType type);
+
   /**
    * @param type type of plan for which skipped count is to be returned
    * @return the count of plans of specified type which were skipped

http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java
index 0e2c7dd..8190f27 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java
@@ -26,15 +26,16 @@ import java.util.List;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.HBaseIOException;
-import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.RegionLoad;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
-import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.hadoop.hbase.client.MasterSwitchType;
+import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.hadoop.hbase.master.MasterRpcServices;
 import org.apache.hadoop.hbase.master.MasterServices;
 import org.apache.hadoop.hbase.master.normalizer.NormalizationPlan.PlanType;
+import org.apache.yetus.audience.InterfaceAudience;
+
 import org.apache.hadoop.hbase.shaded.protobuf.RequestConverter;
 
 /**
@@ -80,7 +81,7 @@ public class SimpleRegionNormalizer implements RegionNormalizer {
   }
 
   @Override
-  public void planSkipped(HRegionInfo hri, PlanType type) {
+  public void planSkipped(RegionInfo hri, PlanType type) {
     skippedCount[type.ordinal()]++;
   }
 
@@ -119,7 +120,7 @@ public class SimpleRegionNormalizer implements RegionNormalizer {
     }
 
     List<NormalizationPlan> plans = new ArrayList<>();
-    List<HRegionInfo> tableRegions = masterServices.getAssignmentManager().getRegionStates().
+    List<RegionInfo> tableRegions = masterServices.getAssignmentManager().getRegionStates().
       getRegionsOfTable(table);
 
     //TODO: should we make min number of regions a config param?
@@ -137,7 +138,7 @@ public class SimpleRegionNormalizer implements RegionNormalizer {
     int acutalRegionCnt = 0;
 
     for (int i = 0; i < tableRegions.size(); i++) {
-      HRegionInfo hri = tableRegions.get(i);
+      RegionInfo hri = tableRegions.get(i);
       long regionSize = getRegionSize(hri);
       if (regionSize > 0) {
         acutalRegionCnt++;
@@ -165,7 +166,7 @@ public class SimpleRegionNormalizer implements RegionNormalizer {
       LOG.debug("Unable to determine whether split is enabled", e);
     }
     while (candidateIdx < tableRegions.size()) {
-      HRegionInfo hri = tableRegions.get(candidateIdx);
+      RegionInfo hri = tableRegions.get(candidateIdx);
       long regionSize = getRegionSize(hri);
       // if the region is > 2 times larger than average, we split it, split
       // is more high priority normalization action than merge.
@@ -180,7 +181,7 @@ public class SimpleRegionNormalizer implements RegionNormalizer {
           break;
         }
         if (mergeEnabled) {
-          HRegionInfo hri2 = tableRegions.get(candidateIdx+1);
+          RegionInfo hri2 = tableRegions.get(candidateIdx+1);
           long regionSize2 = getRegionSize(hri2);
           if (regionSize >= 0 && regionSize2 >= 0 && regionSize + regionSize2 < avgRegionSize) {
             LOG.info("Table " + table + ", small region size: " + regionSize
@@ -201,7 +202,7 @@ public class SimpleRegionNormalizer implements RegionNormalizer {
     return plans;
   }
 
-  private long getRegionSize(HRegionInfo hri) {
+  private long getRegionSize(RegionInfo hri) {
     ServerName sn = masterServices.getAssignmentManager().getRegionStates().
       getRegionServerOfRegion(hri);
     RegionLoad regionLoad = masterServices.getServerManager().getLoad(sn).

http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SplitNormalizationPlan.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SplitNormalizationPlan.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SplitNormalizationPlan.java
index a5912f6..9217143 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SplitNormalizationPlan.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SplitNormalizationPlan.java
@@ -18,15 +18,14 @@
  */
 package org.apache.hadoop.hbase.master.normalizer;
 
+import java.io.IOException;
+import java.util.Arrays;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.master.normalizer.NormalizationPlan.PlanType;
-
-import java.io.IOException;
-import java.util.Arrays;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.yetus.audience.InterfaceAudience;
 
 /**
  * Normalization plan to split region.
@@ -35,10 +34,10 @@ import java.util.Arrays;
 public class SplitNormalizationPlan implements NormalizationPlan {
   private static final Log LOG = LogFactory.getLog(SplitNormalizationPlan.class.getName());
 
-  private HRegionInfo regionInfo;
+  private RegionInfo regionInfo;
   private byte[] splitPoint;
 
-  public SplitNormalizationPlan(HRegionInfo regionInfo, byte[] splitPoint) {
+  public SplitNormalizationPlan(RegionInfo regionInfo, byte[] splitPoint) {
     this.regionInfo = regionInfo;
     this.splitPoint = splitPoint;
   }
@@ -48,11 +47,11 @@ public class SplitNormalizationPlan implements NormalizationPlan {
     return PlanType.SPLIT;
   }
 
-  public HRegionInfo getRegionInfo() {
+  public RegionInfo getRegionInfo() {
     return regionInfo;
   }
 
-  public void setRegionInfo(HRegionInfo regionInfo) {
+  public void setRegionInfo(RegionInfo regionInfo) {
     this.regionInfo = regionInfo;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/AbstractStateMachineRegionProcedure.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/AbstractStateMachineRegionProcedure.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/AbstractStateMachineRegionProcedure.java
index 3b3d326..e711ca0 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/AbstractStateMachineRegionProcedure.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/AbstractStateMachineRegionProcedure.java
@@ -19,12 +19,15 @@
 package org.apache.hadoop.hbase.master.procedure;
 
 import java.io.IOException;
-import org.apache.hadoop.hbase.HRegionInfo;
+
 import org.apache.hadoop.hbase.MetaTableAccessor;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.TableNotFoundException;
-import org.apache.yetus.audience.InterfaceAudience;
+import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.hadoop.hbase.procedure2.ProcedureStateSerializer;
+import org.apache.yetus.audience.InterfaceAudience;
+
+import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos;
 
 /**
@@ -35,11 +38,11 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos;
 @InterfaceAudience.Private
 public abstract class AbstractStateMachineRegionProcedure<TState>
     extends AbstractStateMachineTableProcedure<TState> {
-  private HRegionInfo hri;
+  private RegionInfo hri;
   private volatile boolean lock = false;
 
   public AbstractStateMachineRegionProcedure(final MasterProcedureEnv env,
-      final HRegionInfo hri) {
+      final RegionInfo hri) {
     super(env);
     this.hri = hri;
   }
@@ -50,16 +53,16 @@ public abstract class AbstractStateMachineRegionProcedure<TState>
   }
 
   /**
-   * @return The HRegionInfo of the region we are operating on.
+   * @return The RegionInfo of the region we are operating on.
    */
-  protected HRegionInfo getRegion() {
+  protected RegionInfo getRegion() {
     return this.hri;
   }
 
   /**
    * Used when deserializing. Otherwise, DON'T TOUCH IT!
    */
-  protected void setRegion(final HRegionInfo hri) {
+  protected void setRegion(final RegionInfo hri) {
     this.hri = hri;
   }
 
@@ -124,13 +127,13 @@ public abstract class AbstractStateMachineRegionProcedure<TState>
   protected void serializeStateData(ProcedureStateSerializer serializer)
       throws IOException {
     super.serializeStateData(serializer);
-    serializer.serialize(HRegionInfo.convert(getRegion()));
+    serializer.serialize(ProtobufUtil.toRegionInfo(getRegion()));
   }
 
   @Override
   protected void deserializeStateData(ProcedureStateSerializer serializer)
       throws IOException {
     super.deserializeStateData(serializer);
-    this.hri = HRegionInfo.convert(serializer.deserialize(HBaseProtos.RegionInfo.class));
+    this.hri = ProtobufUtil.toRegionInfo(serializer.deserialize(HBaseProtos.RegionInfo.class));
   }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a11a35a1/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/AddColumnFamilyProcedure.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/AddColumnFamilyProcedure.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/AddColumnFamilyProcedure.java
index 176ff3d..8351524 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/AddColumnFamilyProcedure.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/AddColumnFamilyProcedure.java
@@ -23,15 +23,16 @@ import java.util.List;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.InvalidFamilyOperationException;
 import org.apache.hadoop.hbase.TableName;
-import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.hadoop.hbase.client.TableDescriptor;
 import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
 import org.apache.hadoop.hbase.master.MasterCoprocessorHost;
 import org.apache.hadoop.hbase.procedure2.ProcedureStateSerializer;
+import org.apache.yetus.audience.InterfaceAudience;
+
 import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.AddColumnFamilyState;
@@ -48,7 +49,7 @@ public class AddColumnFamilyProcedure
   private TableDescriptor unmodifiedTableDescriptor;
   private ColumnFamilyDescriptor cfDescriptor;
 
-  private List<HRegionInfo> regionInfoList;
+  private List<RegionInfo> regionInfoList;
   private Boolean traceEnabled;
 
   public AddColumnFamilyProcedure() {
@@ -347,7 +348,7 @@ public class AddColumnFamilyProcedure
     }
   }
 
-  private List<HRegionInfo> getRegionInfoList(final MasterProcedureEnv env) throws IOException {
+  private List<RegionInfo> getRegionInfoList(final MasterProcedureEnv env) throws IOException {
     if (regionInfoList == null) {
       regionInfoList = env.getAssignmentManager().getRegionStates()
           .getRegionsOfTable(getTableName());


Mime
View raw message