hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chia7...@apache.org
Subject [1/3] hbase git commit: HBASE-19596 RegionMetrics/ServerMetrics/ClusterMetrics should apply to all public classes
Date Thu, 04 Jan 2018 05:17:23 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 2bd259b44 -> 8119acfca


http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseCluster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseCluster.java
index 58ae059..59a0059 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseCluster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseCluster.java
@@ -19,16 +19,16 @@ package org.apache.hadoop.hbase;
 
 import java.io.Closeable;
 import java.io.IOException;
-
+import org.apache.hadoop.conf.Configurable;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.util.Threads;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.hadoop.conf.Configurable;
-import org.apache.hadoop.conf.Configuration;
+
 import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService;
-import org.apache.hadoop.hbase.util.Threads;
 
 /**
  * This class defines methods that can help with managing HBase clusters
@@ -61,7 +61,7 @@ public abstract class HBaseCluster implements Closeable, Configurable {
   protected Configuration conf;
 
   /** the status of the cluster before we begin */
-  protected ClusterStatus initialClusterStatus;
+  protected ClusterMetrics initialClusterStatus;
 
   /**
    * Construct an HBaseCluster
@@ -82,16 +82,16 @@ public abstract class HBaseCluster implements Closeable, Configurable {
   }
 
   /**
-   * Returns a ClusterStatus for this HBase cluster.
-   * @see #getInitialClusterStatus()
+   * Returns a ClusterMetrics for this HBase cluster.
+   * @see #getInitialClusterMetrics()
    */
-  public abstract ClusterStatus getClusterStatus() throws IOException;
+  public abstract ClusterMetrics getClusterMetrics() throws IOException;
 
   /**
    * Returns a ClusterStatus for this HBase cluster as observed at the
    * starting of the HBaseCluster
    */
-  public ClusterStatus getInitialClusterStatus() throws IOException {
+  public ClusterMetrics getInitialClusterMetrics() throws IOException {
     return initialClusterStatus;
   }
 
@@ -153,7 +153,7 @@ public abstract class HBaseCluster implements Closeable, Configurable {
       throws IOException {
     long start = System.currentTimeMillis();
     while ((System.currentTimeMillis() - start) < timeout) {
-      for (ServerName server : getClusterStatus().getServers()) {
+      for (ServerName server : getClusterMetrics().getLiveServerMetrics().keySet()) {
         if (server.getHostname().equals(hostname) && server.getPort() == port) {
           return;
         }
@@ -317,7 +317,7 @@ public abstract class HBaseCluster implements Closeable, Configurable {
    * @return whether restoration is complete
    */
   public boolean restoreInitialStatus() throws IOException {
-    return restoreClusterStatus(getInitialClusterStatus());
+    return restoreClusterMetrics(getInitialClusterMetrics());
   }
 
   /**
@@ -327,7 +327,7 @@ public abstract class HBaseCluster implements Closeable, Configurable {
    * permissions, etc. restoration might be partial.
    * @return whether restoration is complete
    */
-  public boolean restoreClusterStatus(ClusterStatus desiredStatus) throws IOException {
+  public boolean restoreClusterMetrics(ClusterMetrics desiredStatus) throws IOException {
     return true;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
index 9e17a79..304b3cb 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
@@ -22,7 +22,6 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import edu.umd.cs.findbugs.annotations.Nullable;
-
 import java.io.File;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -52,7 +51,6 @@ import java.util.UUID;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
-
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.RandomStringUtils;
 import org.apache.commons.logging.impl.Jdk14Logger;
@@ -151,6 +149,7 @@ import org.apache.zookeeper.ZooKeeper.States;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.impl.Log4jLoggerAdapter;
+
 import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
 
 /**
@@ -3735,7 +3734,7 @@ public class HBaseTestingUtility extends HBaseZKTestingUtility {
       // The number of splits is set as:
       //    region servers * regions per region server).
       int numberOfServers =
-          admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).getServers()
+          admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics()
               .size();
       if (numberOfServers == 0) {
         throw new IllegalStateException("No live regionservers");

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java
index ad58124..92715ee 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java
@@ -23,19 +23,10 @@ import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
-
 import java.util.Set;
-
-import org.apache.yetus.audience.InterfaceAudience;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.hbase.master.HMaster;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionServerStartupResponse;
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.HRegionServer;
 import org.apache.hadoop.hbase.regionserver.Region;
@@ -45,6 +36,14 @@ import org.apache.hadoop.hbase.util.JVMClusterUtil;
 import org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread;
 import org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread;
 import org.apache.hadoop.hbase.util.Threads;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.AdminService;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ClientService;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.MasterService;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionServerStartupResponse;
 
 /**
  * This class creates a single process HBase cluster.
@@ -629,10 +628,20 @@ public class MiniHBaseCluster extends HBaseCluster {
   public void close() throws IOException {
   }
 
-  @Override
+  /**
+   * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
+   *             Use {@link #getClusterMetrics()} instead.
+   */
+  @Deprecated
   public ClusterStatus getClusterStatus() throws IOException {
     HMaster master = getMaster();
-    return master == null ? null : master.getClusterStatus();
+    return master == null ? null : new ClusterStatus(master.getClusterMetrics());
+  }
+
+  @Override
+  public ClusterMetrics getClusterMetrics() throws IOException {
+    HMaster master = getMaster();
+    return master == null ? null : master.getClusterMetrics();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterMetrics.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterMetrics.java
index ac116d8..b268842 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterMetrics.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterMetrics.java
@@ -23,7 +23,6 @@ import java.util.List;
 import java.util.Optional;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.atomic.AtomicInteger;
-import java.util.stream.Stream;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.ClusterMetrics.Option;
 import org.apache.hadoop.hbase.Waiter.Predicate;
@@ -77,8 +76,8 @@ public class TestClientClusterMetrics {
 
   @Test
   public void testDefaults() throws Exception {
-    ClusterMetrics origin = ADMIN.getClusterStatus();
-    ClusterMetrics defaults = ADMIN.getClusterStatus(EnumSet.allOf(Option.class));
+    ClusterMetrics origin = ADMIN.getClusterMetrics();
+    ClusterMetrics defaults = ADMIN.getClusterMetrics(EnumSet.allOf(Option.class));
     Assert.assertEquals(origin.getHBaseVersion(), defaults.getHBaseVersion());
     Assert.assertEquals(origin.getClusterId(), defaults.getClusterId());
     Assert.assertEquals(origin.getAverageLoad(), defaults.getAverageLoad(), 0);
@@ -96,10 +95,10 @@ public class TestClientClusterMetrics {
     try (AsyncConnection asyncConnect = ConnectionFactory.createAsyncConnection(
       UTIL.getConfiguration()).get()) {
       AsyncAdmin asyncAdmin = asyncConnect.getAdmin();
-      CompletableFuture<ClusterStatus> originFuture =
-        asyncAdmin.getClusterStatus();
-      CompletableFuture<ClusterStatus> defaultsFuture =
-        asyncAdmin.getClusterStatus(EnumSet.allOf(Option.class));
+      CompletableFuture<ClusterMetrics> originFuture =
+        asyncAdmin.getClusterMetrics();
+      CompletableFuture<ClusterMetrics> defaultsFuture =
+        asyncAdmin.getClusterMetrics(EnumSet.allOf(Option.class));
       ClusterMetrics origin = originFuture.get();
       ClusterMetrics defaults = defaultsFuture.get();
       Assert.assertEquals(origin.getHBaseVersion(), defaults.getHBaseVersion());
@@ -133,14 +132,14 @@ public class TestClientClusterMetrics {
     Waiter.waitFor(CLUSTER.getConfiguration(), 10 * 1000, 100, new Predicate<Exception>() {
       @Override
       public boolean evaluate() throws Exception {
-        ClusterMetrics metrics = ADMIN.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS));
+        ClusterMetrics metrics = ADMIN.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS));
         Assert.assertNotNull(metrics);
         return metrics.getRegionCount() > 0;
       }
     });
     // Retrieve live servers and dead servers info.
     EnumSet<Option> options = EnumSet.of(Option.LIVE_SERVERS, Option.DEAD_SERVERS);
-    ClusterMetrics metrics = ADMIN.getClusterStatus(options);
+    ClusterMetrics metrics = ADMIN.getClusterMetrics(options);
     Assert.assertNotNull(metrics);
     // exclude a dead region server
     Assert.assertEquals(SLAVES -1, numRs);
@@ -176,7 +175,7 @@ public class TestClientClusterMetrics {
     Assert.assertEquals(MASTERS, masterThreads.size());
     // Retrieve master and backup masters infos only.
     EnumSet<Option> options = EnumSet.of(Option.MASTER, Option.BACKUP_MASTERS);
-    ClusterMetrics metrics = ADMIN.getClusterStatus(options);
+    ClusterMetrics metrics = ADMIN.getClusterMetrics(options);
     Assert.assertTrue(metrics.getMasterName().equals(activeName));
     Assert.assertEquals(MASTERS - 1, metrics.getBackupMasterNames().size());
   }
@@ -186,7 +185,7 @@ public class TestClientClusterMetrics {
     EnumSet<Option> options =
         EnumSet.of(Option.MASTER_COPROCESSORS, Option.HBASE_VERSION,
                    Option.CLUSTER_ID, Option.BALANCER_ON);
-    ClusterMetrics metrics = ADMIN.getClusterStatus(options);
+    ClusterMetrics metrics = ADMIN.getClusterMetrics(options);
     Assert.assertEquals(1, metrics.getMasterCoprocessorNames().size());
     Assert.assertNotNull(metrics.getHBaseVersion());
     Assert.assertNotNull(metrics.getClusterId());
@@ -206,7 +205,7 @@ public class TestClientClusterMetrics {
   public void testObserver() throws IOException {
     int preCount = MyObserver.PRE_COUNT.get();
     int postCount = MyObserver.POST_COUNT.get();
-    Assert.assertTrue(Stream.of(ADMIN.getClusterStatus().getMasterCoprocessors())
+    Assert.assertTrue(ADMIN.getClusterMetrics().getMasterCoprocessorNames().stream()
         .anyMatch(s -> s.equals(MyObserver.class.getSimpleName())));
     Assert.assertEquals(preCount + 1, MyObserver.PRE_COUNT.get());
     Assert.assertEquals(postCount + 1, MyObserver.POST_COUNT.get());
@@ -220,13 +219,13 @@ public class TestClientClusterMetrics {
       return Optional.of(this);
     }
 
-    @Override public void preGetClusterStatus(ObserverContext<MasterCoprocessorEnvironment> ctx)
+    @Override public void preGetClusterMetrics(ObserverContext<MasterCoprocessorEnvironment> ctx)
         throws IOException {
       PRE_COUNT.incrementAndGet();
     }
 
-    @Override public void postGetClusterStatus(ObserverContext<MasterCoprocessorEnvironment> ctx,
-        ClusterStatus metrics) throws IOException {
+    @Override public void postGetClusterMetrics(ObserverContext<MasterCoprocessorEnvironment> ctx,
+        ClusterMetrics metrics) throws IOException {
       POST_COUNT.incrementAndGet();
     }
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterStatus.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterStatus.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterStatus.java
index 245f3c9..d7e6f14 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterStatus.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterStatus.java
@@ -21,16 +21,12 @@ import java.io.IOException;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.Optional;
-import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Stream;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.ClusterMetrics.Option;
 import org.apache.hadoop.hbase.Waiter.Predicate;
 import org.apache.hadoop.hbase.client.Admin;
-import org.apache.hadoop.hbase.client.AsyncAdmin;
-import org.apache.hadoop.hbase.client.AsyncConnection;
-import org.apache.hadoop.hbase.client.ConnectionFactory;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
 import org.apache.hadoop.hbase.coprocessor.MasterCoprocessor;
 import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
@@ -81,7 +77,8 @@ public class TestClientClusterStatus {
   @Test
   public void testDefaults() throws Exception {
     ClusterStatus origin = ADMIN.getClusterStatus();
-    ClusterStatus defaults = ADMIN.getClusterStatus(EnumSet.allOf(Option.class));
+    ClusterStatus defaults
+        = new ClusterStatus(ADMIN.getClusterMetrics(EnumSet.allOf(Option.class)));
     checkPbObjectNotNull(origin);
     checkPbObjectNotNull(defaults);
     Assert.assertEquals(origin.getHBaseVersion(), defaults.getHBaseVersion());
@@ -97,37 +94,16 @@ public class TestClientClusterStatus {
 
   @Test
   public void testNone() throws Exception {
-    ClusterStatus status0 = ADMIN.getClusterStatus(EnumSet.allOf(Option.class));
-    ClusterStatus status1 = ADMIN.getClusterStatus(EnumSet.noneOf(Option.class));
+    ClusterStatus status0
+      = new ClusterStatus(ADMIN.getClusterMetrics(EnumSet.allOf(Option.class)));
+    ClusterStatus status1
+      = new ClusterStatus(ADMIN.getClusterMetrics(EnumSet.noneOf(Option.class)));
     Assert.assertEquals(status0, status1);
     checkPbObjectNotNull(status0);
     checkPbObjectNotNull(status1);
   }
 
   @Test
-  public void testAsyncClient() throws Exception {
-    try (AsyncConnection asyncConnect = ConnectionFactory.createAsyncConnection(
-      UTIL.getConfiguration()).get()) {
-      AsyncAdmin asyncAdmin = asyncConnect.getAdmin();
-      CompletableFuture<ClusterStatus> originFuture =
-        asyncAdmin.getClusterStatus();
-      CompletableFuture<ClusterStatus> defaultsFuture =
-        asyncAdmin.getClusterStatus(EnumSet.allOf(Option.class));
-      ClusterStatus origin = originFuture.get();
-      ClusterStatus defaults = defaultsFuture.get();
-      checkPbObjectNotNull(origin);
-      checkPbObjectNotNull(defaults);
-      Assert.assertEquals(origin.getHBaseVersion(), defaults.getHBaseVersion());
-      Assert.assertEquals(origin.getClusterId(), defaults.getClusterId());
-      Assert.assertTrue(origin.getAverageLoad() == defaults.getAverageLoad());
-      Assert.assertTrue(origin.getBackupMastersSize() == defaults.getBackupMastersSize());
-      Assert.assertTrue(origin.getDeadServersSize() == defaults.getDeadServersSize());
-      Assert.assertTrue(origin.getRegionsCount() == defaults.getRegionsCount());
-      Assert.assertTrue(origin.getServersSize() == defaults.getServersSize());
-    }
-  }
-
-  @Test
   public void testLiveAndDeadServersStatus() throws Exception {
     // Count the number of live regionservers
     List<RegionServerThread> regionserverThreads = CLUSTER.getLiveRegionServerThreads();
@@ -143,14 +119,15 @@ public class TestClientClusterStatus {
     Waiter.waitFor(CLUSTER.getConfiguration(), 10 * 1000, 100, new Predicate<Exception>() {
       @Override
       public boolean evaluate() throws Exception {
-        ClusterStatus status = ADMIN.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS));
+        ClusterStatus status
+          = new ClusterStatus(ADMIN.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)));
         Assert.assertNotNull(status);
         return status.getRegionsCount() > 0;
       }
     });
     // Retrieve live servers and dead servers info.
     EnumSet<Option> options = EnumSet.of(Option.LIVE_SERVERS, Option.DEAD_SERVERS);
-    ClusterStatus status = ADMIN.getClusterStatus(options);
+    ClusterStatus status = new ClusterStatus(ADMIN.getClusterMetrics(options));
     checkPbObjectNotNull(status);
     Assert.assertNotNull(status);
     Assert.assertNotNull(status.getServers());
@@ -188,7 +165,7 @@ public class TestClientClusterStatus {
     Assert.assertEquals(MASTERS, masterThreads.size());
     // Retrieve master and backup masters infos only.
     EnumSet<Option> options = EnumSet.of(Option.MASTER, Option.BACKUP_MASTERS);
-    ClusterStatus status = ADMIN.getClusterStatus(options);
+    ClusterStatus status = new ClusterStatus(ADMIN.getClusterMetrics(options));
     Assert.assertTrue(status.getMaster().equals(activeName));
     Assert.assertEquals(MASTERS - 1, status.getBackupMastersSize());
   }
@@ -198,7 +175,7 @@ public class TestClientClusterStatus {
     EnumSet<Option> options =
         EnumSet.of(Option.MASTER_COPROCESSORS, Option.HBASE_VERSION,
                    Option.CLUSTER_ID, Option.BALANCER_ON);
-    ClusterStatus status = ADMIN.getClusterStatus(options);
+    ClusterStatus status = new ClusterStatus(ADMIN.getClusterMetrics(options));
     Assert.assertTrue(status.getMasterCoprocessors().length == 1);
     Assert.assertNotNull(status.getHBaseVersion());
     Assert.assertNotNull(status.getClusterId());
@@ -245,13 +222,13 @@ public class TestClientClusterStatus {
       return Optional.of(this);
     }
 
-    @Override public void preGetClusterStatus(ObserverContext<MasterCoprocessorEnvironment> ctx)
+    @Override public void preGetClusterMetrics(ObserverContext<MasterCoprocessorEnvironment> ctx)
         throws IOException {
       PRE_COUNT.incrementAndGet();
     }
 
-    @Override public void postGetClusterStatus(ObserverContext<MasterCoprocessorEnvironment> ctx,
-        ClusterStatus status) throws IOException {
+    @Override public void postGetClusterMetrics(ObserverContext<MasterCoprocessorEnvironment> ctx,
+      ClusterMetrics status) throws IOException {
       POST_COUNT.incrementAndGet();
     }
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionLoad.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionLoad.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionLoad.java
index e62d212..c1dab38 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionLoad.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionLoad.java
@@ -28,6 +28,8 @@ import java.util.Collection;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.Map;
+import java.util.TreeMap;
+import java.util.stream.Collectors;
 import org.apache.hadoop.hbase.ClusterMetrics.Option;
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Table;
@@ -83,9 +85,10 @@ public class TestRegionLoad {
 
     // Check if regions match with the regionLoad from the server
     for (ServerName serverName : admin
-        .getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).getServers()) {
+        .getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics().keySet()) {
       List<HRegionInfo> regions = admin.getOnlineRegions(serverName);
-      Collection<RegionLoad> regionLoads = admin.getRegionLoad(serverName).values();
+      Collection<RegionLoad> regionLoads = admin.getRegionMetrics(serverName)
+        .stream().map(r -> new RegionLoad(r)).collect(Collectors.toList());
       checkRegionsAndRegionLoads(regions, regionLoads);
     }
 
@@ -95,17 +98,23 @@ public class TestRegionLoad {
 
       List<RegionLoad> regionLoads = Lists.newArrayList();
       for (ServerName serverName : admin
-          .getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).getServers()) {
-        regionLoads.addAll(admin.getRegionLoad(serverName, table).values());
+          .getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics().keySet()) {
+        regionLoads.addAll(admin.getRegionMetrics(serverName, table)
+          .stream().map(r -> new RegionLoad(r)).collect(Collectors.toList()));
       }
       checkRegionsAndRegionLoads(tableRegions, regionLoads);
     }
 
     // Check RegionLoad matches the regionLoad from ClusterStatus
-    ClusterStatus clusterStatus = admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS));
+    ClusterStatus clusterStatus
+      = new ClusterStatus(admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)));
     for (ServerName serverName : clusterStatus.getServers()) {
       ServerLoad serverLoad = clusterStatus.getLoad(serverName);
-      Map<byte[], RegionLoad> regionLoads = admin.getRegionLoad(serverName);
+      Map<byte[], RegionLoad> regionLoads = admin.getRegionMetrics(serverName).stream()
+        .collect(Collectors.toMap(e -> e.getRegionName(), e -> new RegionLoad(e),
+          (v1, v2) -> {
+            throw new RuntimeException("impossible!!");
+          }, () -> new TreeMap<>(Bytes.BYTES_COMPARATOR)));
       compareRegionLoads(serverLoad.getRegionsLoad(), regionLoads);
     }
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionMetrics.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionMetrics.java
index 329b544..34196e2 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionMetrics.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionMetrics.java
@@ -27,7 +27,6 @@ import java.util.Collection;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.Map;
-import java.util.stream.Collectors;
 import org.apache.hadoop.hbase.ClusterMetrics.Option;
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.RegionInfo;
@@ -79,11 +78,11 @@ public class TestRegionMetrics {
   public void testRegionMetrics() throws Exception {
 
     // Check if regions match with the RegionMetrics from the server
-    for (ServerName serverName : admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS))
+    for (ServerName serverName : admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS))
         .getLiveServerMetrics().keySet()) {
       List<RegionInfo> regions = admin.getRegions(serverName);
       Collection<RegionMetrics> regionMetricsList =
-          admin.getRegionLoads(serverName).stream().collect(Collectors.toList());
+          admin.getRegionMetrics(serverName);
       checkRegionsAndRegionMetrics(regions, regionMetricsList);
     }
 
@@ -92,21 +91,20 @@ public class TestRegionMetrics {
       List<RegionInfo> tableRegions = admin.getRegions(table);
 
       List<RegionMetrics> regionMetrics = new ArrayList<>();
-      for (ServerName serverName : admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS))
+      for (ServerName serverName : admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS))
           .getLiveServerMetrics().keySet()) {
-        regionMetrics.addAll(admin.getRegionLoads(serverName, table));
+        regionMetrics.addAll(admin.getRegionMetrics(serverName, table));
       }
       checkRegionsAndRegionMetrics(tableRegions, regionMetrics);
     }
 
     // Check RegionMetrics matches the RegionMetrics from ClusterStatus
-    ClusterMetrics clusterStatus = admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS));
+    ClusterMetrics clusterStatus = admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS));
     for (Map.Entry<ServerName, ServerMetrics> entry : clusterStatus.getLiveServerMetrics()
         .entrySet()) {
       ServerName serverName = entry.getKey();
       ServerMetrics serverMetrics = entry.getValue();
-      List<RegionMetrics> regionMetrics =
-          admin.getRegionLoads(serverName).stream().collect(Collectors.toList());
+      List<RegionMetrics> regionMetrics = admin.getRegionMetrics(serverName);
       assertEquals(serverMetrics.getRegionMetrics().size(), regionMetrics.size());
     }
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/TestStochasticBalancerJmxMetrics.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestStochasticBalancerJmxMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestStochasticBalancerJmxMetrics.java
index 22ab8b9..c5e6464 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestStochasticBalancerJmxMetrics.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestStochasticBalancerJmxMetrics.java
@@ -20,13 +20,6 @@ package org.apache.hadoop.hbase;
 
 import static org.junit.Assert.assertTrue;
 
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanInfo;
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXConnectorFactory;
 import java.io.IOException;
 import java.util.HashSet;
 import java.util.Hashtable;
@@ -35,7 +28,13 @@ import java.util.List;
 import java.util.Map;
 import java.util.Random;
 import java.util.Set;
-
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanInfo;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
@@ -156,7 +155,7 @@ public class TestStochasticBalancerJmxMetrics extends BalancerTestBase {
     conf.setBoolean(HConstants.HBASE_MASTER_LOADBALANCE_BYTABLE, true);
     loadBalancer.setConf(conf);
 
-    // NOTE the size is normally set in setClusterStatus, for test purpose, we set it manually
+    // NOTE the size is normally set in setClusterMetrics, for test purpose, we set it manually
     // Tables: hbase:namespace, table1, table2
     // Functions: costFunctions, overall
     String[] functionNames = loadBalancer.getCostFunctionNames();

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
index d701a81..05b8edc 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
@@ -698,7 +698,8 @@ public class TestAdmin2 {
     TEST_UTIL.createMultiRegionTable(tableName, "f".getBytes(), 6);
 
     ArrayList<ServerName> clusterRegionServers =
-        new ArrayList<>(admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).getServers());
+        new ArrayList<>(admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS))
+          .getLiveServerMetrics().keySet());
 
     assertEquals(clusterRegionServers.size(), 3);
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi.java
index e0040b8..5b33ad0 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi.java
@@ -32,12 +32,12 @@ import java.util.EnumSet;
 import java.util.List;
 import java.util.Map;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.ClusterMetrics;
 import org.apache.hadoop.hbase.ClusterMetrics.Option;
-import org.apache.hadoop.hbase.ClusterStatus;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.RegionLoad;
-import org.apache.hadoop.hbase.ServerLoad;
+import org.apache.hadoop.hbase.RegionMetrics;
+import org.apache.hadoop.hbase.ServerMetrics;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.regionserver.HRegion;
@@ -244,38 +244,43 @@ public class TestAsyncClusterAdminApi extends TestAsyncAdminBase {
     Collection<ServerName> servers = admin.getRegionServers().get();
     for (ServerName serverName : servers) {
       List<RegionInfo> regions = admin.getRegions(serverName).get();
-      checkRegionsAndRegionLoads(regions, admin.getRegionLoads(serverName).get());
+      checkRegionsAndRegionLoads(regions, admin.getRegionMetrics(serverName).get());
     }
 
     // Check if regionLoad matches the table's regions and nothing is missed
     for (TableName table : tables) {
       List<RegionInfo> tableRegions = admin.getRegions(table).get();
-      List<RegionLoad> regionLoads = Lists.newArrayList();
+      List<RegionMetrics> regionLoads = Lists.newArrayList();
       for (ServerName serverName : servers) {
-        regionLoads.addAll(admin.getRegionLoads(serverName, table).get());
+        regionLoads.addAll(admin.getRegionMetrics(serverName, table).get());
       }
       checkRegionsAndRegionLoads(tableRegions, regionLoads);
     }
 
     // Check RegionLoad matches the regionLoad from ClusterStatus
-    ClusterStatus clusterStatus = admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).get();
-    for (ServerName serverName : clusterStatus.getServers()) {
-      ServerLoad serverLoad = clusterStatus.getLoad(serverName);
-      compareRegionLoads(serverLoad.getRegionsLoad().values(), admin.getRegionLoads(serverName)
-          .get());
+    ClusterMetrics clusterStatus = admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).get();
+    for (Map.Entry<ServerName, ServerMetrics> entry :
+      clusterStatus.getLiveServerMetrics().entrySet()) {
+      ServerName sn = entry.getKey();
+      ServerMetrics sm = entry.getValue();
+      compareRegionLoads(sm.getRegionMetrics().values(), admin.getRegionMetrics(sn).get());
+    }
+    for (ServerName serverName : clusterStatus.getLiveServerMetrics().keySet()) {
+      ServerMetrics serverLoad = clusterStatus.getLiveServerMetrics().get(serverName);
+
     }
   }
 
-  private void compareRegionLoads(Collection<RegionLoad> regionLoadCluster,
-      Collection<RegionLoad> regionLoads) {
+  private void compareRegionLoads(Collection<RegionMetrics> regionLoadCluster,
+      Collection<RegionMetrics> regionLoads) {
 
     assertEquals("No of regionLoads from clusterStatus and regionloads from RS doesn't match",
       regionLoadCluster.size(), regionLoads.size());
 
-    for (RegionLoad loadCluster : regionLoadCluster) {
+    for (RegionMetrics loadCluster : regionLoadCluster) {
       boolean matched = false;
-      for (RegionLoad load : regionLoads) {
-        if (Bytes.equals(loadCluster.getName(), load.getName())) {
+      for (RegionMetrics load : regionLoads) {
+        if (Bytes.equals(loadCluster.getRegionName(), load.getRegionName())) {
           matched = true;
           continue;
         }
@@ -285,13 +290,13 @@ public class TestAsyncClusterAdminApi extends TestAsyncAdminBase {
   }
 
   private void checkRegionsAndRegionLoads(Collection<RegionInfo> regions,
-      Collection<RegionLoad> regionLoads) {
+      Collection<RegionMetrics> regionLoads) {
 
     assertEquals("No of regions and regionloads doesn't match", regions.size(), regionLoads.size());
 
-    Map<byte[], RegionLoad> regionLoadMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
-    for (RegionLoad regionLoad : regionLoads) {
-      regionLoadMap.put(regionLoad.getName(), regionLoad);
+    Map<byte[], RegionMetrics> regionLoadMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
+    for (RegionMetrics regionLoad : regionLoads) {
+      regionLoadMap.put(regionLoad.getRegionName(), regionLoad);
     }
     for (RegionInfo info : regions) {
       assertTrue("Region not in regionLoadMap region:" + info.getRegionNameAsString()

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncDecommissionAdminApi.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncDecommissionAdminApi.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncDecommissionAdminApi.java
index a3d7616..8c2b060 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncDecommissionAdminApi.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncDecommissionAdminApi.java
@@ -46,7 +46,8 @@ public class TestAsyncDecommissionAdminApi extends TestAsyncAdminBase {
     TEST_UTIL.createMultiRegionTable(tableName, FAMILY, 4);
 
     ArrayList<ServerName> clusterRegionServers =
-        new ArrayList<>(admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).get().getServers());
+        new ArrayList<>(admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).get()
+          .getLiveServerMetrics().keySet());
 
     assertEquals(clusterRegionServers.size(), 2);
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
index e48667e..f17c291 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
@@ -44,7 +44,6 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.atomic.AtomicReference;
-
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.Cell;
@@ -58,10 +57,10 @@ import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HRegionLocation;
 import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.PrivateCellUtil;
 import org.apache.hadoop.hbase.KeepDeletedCells;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
+import org.apache.hadoop.hbase.PrivateCellUtil;
 import org.apache.hadoop.hbase.RegionLocations;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
@@ -4261,8 +4260,8 @@ public class TestFromClientSide {
     boolean tablesOnMaster = LoadBalancer.isTablesOnMaster(TEST_UTIL.getConfiguration());
     try (Admin admin = conn.getAdmin()) {
       assertTrue(admin.tableExists(tableName));
-      assertTrue(admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS))
-          .getServersSize() == SLAVES + (tablesOnMaster ? 1 : 0));
+      assertTrue(admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS))
+          .getLiveServerMetrics().size() == SLAVES + (tablesOnMaster ? 1 : 0));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
index 4497a529..e01c28f 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
@@ -23,13 +23,13 @@ import static org.apache.hadoop.hbase.util.hbck.HbckTestingUtil.doFsck;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import edu.umd.cs.findbugs.annotations.Nullable;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.Abortable;
 import org.apache.hadoop.hbase.CategoryBasedTimeout;
@@ -68,8 +68,6 @@ import org.junit.rules.TestRule;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import edu.umd.cs.findbugs.annotations.Nullable;
-
 /**
  * Tests the scenarios where replicas are enabled for the meta table
  */
@@ -207,7 +205,7 @@ public class TestMetaWithReplicas {
           Thread.sleep(conf.getInt(StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD,
               30000) * 3);
         }
-        master = util.getHBaseClusterInterface().getClusterStatus().getMaster();
+        master = util.getHBaseClusterInterface().getClusterMetrics().getMasterName();
         // kill the master so that regionserver recovery is not triggered at all
         // for the meta server
         util.getHBaseClusterInterface().stopMaster(master);
@@ -276,7 +274,7 @@ public class TestMetaWithReplicas {
   private void stopMasterAndValidateReplicaCount(final int originalReplicaCount,
       final int newReplicaCount)
       throws Exception {
-    ServerName sn = TEST_UTIL.getHBaseClusterInterface().getClusterStatus().getMaster();
+    ServerName sn = TEST_UTIL.getHBaseClusterInterface().getClusterMetrics().getMasterName();
     TEST_UTIL.getHBaseClusterInterface().stopMaster(sn);
     TEST_UTIL.getHBaseClusterInterface().waitForMasterToStop(sn, 60000);
     List<String> metaZnodes = TEST_UTIL.getZooKeeperWatcher().getMetaReplicaNodes();
@@ -409,7 +407,7 @@ public class TestMetaWithReplicas {
     byte[] data = ZKUtil.getData(zkw, primaryMetaZnode);
     ServerName currentServer = ProtobufUtil.toServerName(data);
     Collection<ServerName> liveServers = TEST_UTIL.getAdmin()
-        .getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).getServers();
+        .getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics().keySet();
     ServerName moveToServer = null;
     for (ServerName s : liveServers) {
       if (!currentServer.equals(s)) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiParallel.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiParallel.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiParallel.java
index 8e44640..49e0a98 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiParallel.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiParallel.java
@@ -336,7 +336,7 @@ public class TestMultiParallel {
         public boolean evaluate() throws Exception {
           // Master is also a regionserver, so the count is liveRScount
           return UTIL.getMiniHBaseCluster().getMaster()
-              .getClusterStatus().getServersSize() == liveRScount;
+              .getClusterMetrics().getLiveServerMetrics().size() == liveRScount;
         }
       });
       UTIL.waitFor(15 * 1000, UTIL.predicateNoRegionsInTransition());

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
index 0309eaa..431e73e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java
@@ -29,7 +29,6 @@ import java.util.List;
 import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.CoprocessorEnvironment;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
@@ -70,6 +69,7 @@ import org.junit.experimental.categories.Category;
 import org.junit.rules.TestName;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
 import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.shaded.protobuf.RequestConverter;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.GetTableDescriptorsRequest;
@@ -1523,7 +1523,7 @@ public class TestMasterObserver {
       assertNotNull("Found a non-null entry", firstGoodPair);
       LOG.info("Found " + firstGoodPair.toString());
       // Try to force a move
-      Collection<ServerName> servers = master.getClusterStatus().getServers();
+      Collection<ServerName> servers = master.getClusterMetrics().getLiveServerMetrics().keySet();
       String destName = null;
       String serverNameForFirstRegion = firstGoodPair.getServerName().toString();
       LOG.info("serverNameForFirstRegion=" + serverNameForFirstRegion);

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java
index ff813eb..e8aa755 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java
@@ -23,9 +23,8 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.util.List;
-
 import org.apache.hadoop.hbase.CategoryBasedTimeout;
-import org.apache.hadoop.hbase.ClusterStatus;
+import org.apache.hadoop.hbase.ClusterMetrics;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
 import org.apache.hadoop.hbase.ServerName;
@@ -97,10 +96,9 @@ public class TestMasterFailover {
 
       // Check that ClusterStatus reports the correct active and backup masters
       assertNotNull(active);
-      ClusterStatus status = active.getClusterStatus();
-      assertTrue(status.getMaster().equals(activeName));
-      assertEquals(2, status.getBackupMastersSize());
-      assertEquals(2, status.getBackupMasters().size());
+      ClusterMetrics status = active.getClusterMetrics();
+      assertTrue(status.getMasterName().equals(activeName));
+      assertEquals(2, status.getBackupMasterNames().size());
 
       // attempt to stop one of the inactive masters
       int backupIndex = (activeIndex == 0 ? 1 : activeIndex - 1);
@@ -119,17 +117,17 @@ public class TestMasterFailover {
       }
       assertEquals(1, numActive);
       assertEquals(2, masterThreads.size());
-      int rsCount = masterThreads.get(activeIndex).getMaster().getClusterStatus().getServersSize();
+      int rsCount = masterThreads.get(activeIndex).getMaster().getClusterMetrics()
+        .getLiveServerMetrics().size();
       LOG.info("Active master " + active.getServerName() + " managing " + rsCount +
           " regions servers");
       assertEquals(3, rsCount);
 
       // Check that ClusterStatus reports the correct active and backup masters
       assertNotNull(active);
-      status = active.getClusterStatus();
-      assertTrue(status.getMaster().equals(activeName));
-      assertEquals(1, status.getBackupMastersSize());
-      assertEquals(1, status.getBackupMasters().size());
+      status = active.getClusterMetrics();
+      assertTrue(status.getMasterName().equals(activeName));
+      assertEquals(1, status.getBackupMasterNames().size());
 
       // kill the active master
       LOG.debug("\n\nStopping the active master " + active.getServerName() + "\n");
@@ -146,13 +144,12 @@ public class TestMasterFailover {
       // and he should be active
       active = masterThreads.get(0).getMaster();
       assertNotNull(active);
-      status = active.getClusterStatus();
-      ServerName mastername = status.getMaster();
+      status = active.getClusterMetrics();
+      ServerName mastername = status.getMasterName();
       assertTrue(mastername.equals(active.getServerName()));
       assertTrue(active.isActiveMaster());
-      assertEquals(0, status.getBackupMastersSize());
-      assertEquals(0, status.getBackupMasters().size());
-      int rss = status.getServersSize();
+      assertEquals(0, status.getBackupMasterNames().size());
+      int rss = status.getLiveServerMetrics().size();
       LOG.info("Active master " + mastername.getServerName() + " managing " +
           rss + " region servers");
       assertEquals(3, rss);

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailoverBalancerPersistence.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailoverBalancerPersistence.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailoverBalancerPersistence.java
index 395fc31..4a451ba 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailoverBalancerPersistence.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailoverBalancerPersistence.java
@@ -18,7 +18,12 @@
  */
 package org.apache.hadoop.hbase.master;
 
-import org.apache.hadoop.hbase.ClusterStatus;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.List;
+import org.apache.hadoop.hbase.ClusterMetrics;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.MasterNotRunningException;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
@@ -28,12 +33,6 @@ import org.apache.hadoop.hbase.util.JVMClusterUtil;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import java.io.IOException;
-import java.util.List;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
 @Category({MasterTests.class, LargeTests.class})
 public class TestMasterFailoverBalancerPersistence {
 
@@ -57,14 +56,14 @@ public class TestMasterFailoverBalancerPersistence {
     assertTrue(cluster.waitForActiveAndReadyMaster());
     HMaster active = cluster.getMaster();
     // check that the balancer is on by default for the active master
-    ClusterStatus clusterStatus = active.getClusterStatus();
-    assertTrue(clusterStatus.isBalancerOn());
+    ClusterMetrics clusterStatus = active.getClusterMetrics();
+    assertTrue(clusterStatus.getBalancerOn());
 
     active = killActiveAndWaitForNewActive(cluster);
 
     // ensure the load balancer is still running on new master
-    clusterStatus = active.getClusterStatus();
-    assertTrue(clusterStatus.isBalancerOn());
+    clusterStatus = active.getClusterMetrics();
+    assertTrue(clusterStatus.getBalancerOn());
 
     // turn off the load balancer
     active.balanceSwitch(false);
@@ -73,8 +72,8 @@ public class TestMasterFailoverBalancerPersistence {
     active = killActiveAndWaitForNewActive(cluster);
 
     // ensure the load balancer is not running on the new master
-    clusterStatus = active.getClusterStatus();
-    assertFalse(clusterStatus.isBalancerOn());
+    clusterStatus = active.getClusterMetrics();
+    assertFalse(clusterStatus.getBalancerOn());
 
     // Stop the cluster
     TEST_UTIL.shutdownMiniCluster();

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java
index 13d9841..cd7af50 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java
@@ -84,8 +84,8 @@ public class TestMasterOperationsForRegionReplicas {
     TEST_UTIL.startMiniCluster(numSlaves);
     CONNECTION = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration());
     ADMIN = CONNECTION.getAdmin();
-    while(ADMIN.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS))
-               .getServers().size() < numSlaves) {
+    while(ADMIN.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS))
+               .getLiveServerMetrics().size() < numSlaves) {
       Thread.sleep(100);
     }
   }
@@ -163,7 +163,7 @@ public class TestMasterOperationsForRegionReplicas {
         ADMIN.getConnection());
 
       // Now kill the master, restart it and see if the assignments are kept
-      ServerName master = TEST_UTIL.getHBaseClusterInterface().getClusterStatus().getMaster();
+      ServerName master = TEST_UTIL.getHBaseClusterInterface().getClusterMetrics().getMasterName();
       TEST_UTIL.getHBaseClusterInterface().stopMaster(master);
       TEST_UTIL.getHBaseClusterInterface().waitForMasterToStop(master, 30000);
       TEST_UTIL.getHBaseClusterInterface().startMaster(master.getHostname(), master.getPort());

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
index 0eff8df..29c24f7 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
@@ -24,9 +24,8 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.util.List;
-
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.ClusterStatus;
+import org.apache.hadoop.hbase.ClusterMetrics;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.LocalHBaseCluster;
@@ -84,9 +83,8 @@ public class TestMasterShutdown {
     }
     assertNotNull(active);
     // make sure the other two are backup masters
-    ClusterStatus status = active.getClusterStatus();
-    assertEquals(2, status.getBackupMastersSize());
-    assertEquals(2, status.getBackupMasters().size());
+    ClusterMetrics status = active.getClusterMetrics();
+    assertEquals(2, status.getBackupMasterNames().size());
 
     // tell the active master to shutdown the cluster
     active.shutdown();

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticBalancerPickers.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticBalancerPickers.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticBalancerPickers.java
index a053f7d..67ed330 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticBalancerPickers.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticBalancerPickers.java
@@ -28,8 +28,8 @@ import java.util.EnumSet;
 import java.util.List;
 import java.util.Map;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.ClusterMetrics;
 import org.apache.hadoop.hbase.ClusterMetrics.Option;
-import org.apache.hadoop.hbase.ClusterStatus;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
@@ -169,14 +169,14 @@ public class TestFavoredStochasticBalancerPickers extends BalancerTestBase {
     TEST_UTIL.getHBaseCluster().startRegionServerAndWait(60000);
 
     Map<ServerName, List<RegionInfo>> serverAssignments = Maps.newHashMap();
-    ClusterStatus status = admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS));
-    for (ServerName sn : status.getServers()) {
+    ClusterMetrics status = admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS));
+    for (ServerName sn : status.getLiveServerMetrics().keySet()) {
       if (!ServerName.isSameAddress(sn, masterServerName)) {
         serverAssignments.put(sn, getTableRegionsFromServer(tableName, sn));
       }
     }
     RegionLocationFinder regionFinder = new RegionLocationFinder();
-    regionFinder.setClusterStatus(admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)));
+    regionFinder.setClusterMetrics(admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)));
     regionFinder.setConf(conf);
     regionFinder.setServices(TEST_UTIL.getMiniHBaseCluster().getMaster());
     Cluster cluster = new Cluster(serverAssignments, null, regionFinder, new RackManager(conf));

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticLoadBalancer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticLoadBalancer.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticLoadBalancer.java
index 8862ea0..89fe35a 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticLoadBalancer.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestFavoredStochasticLoadBalancer.java
@@ -30,6 +30,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.stream.Collectors;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.ClusterMetrics.Option;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
@@ -154,7 +155,7 @@ public class TestFavoredStochasticLoadBalancer extends BalancerTestBase {
     regions.addAll(admin.getTableRegions(TableName.META_TABLE_NAME));
     regions.addAll(admin.getTableRegions(TableName.NAMESPACE_TABLE_NAME));
     List<ServerName> servers = Lists.newArrayList(
-      admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).getServers());
+      admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics().keySet());
     Map<ServerName, List<RegionInfo>> map = balancer.roundRobinAssignment(regions, servers);
     for (List<RegionInfo> regionInfos : map.values()) {
       regions.removeAll(regionInfos);
@@ -181,11 +182,11 @@ public class TestFavoredStochasticLoadBalancer extends BalancerTestBase {
     }
 
     Map<ServerName, List<Integer>> replicaLoadMap = fnm.getReplicaLoad(
-      Lists.newArrayList(admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS))
-                              .getServers()));
+      Lists.newArrayList(admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS))
+                              .getLiveServerMetrics().keySet()));
     assertTrue("Not all replica load collected.",
-      admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS))
-           .getServers().size() == replicaLoadMap.size());
+      admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS))
+           .getLiveServerMetrics().size() == replicaLoadMap.size());
     for (Entry<ServerName, List<Integer>> entry : replicaLoadMap.entrySet()) {
       assertTrue(entry.getValue().size() == FavoredNodeAssignmentHelper.FAVORED_NODES_NUM);
       assertTrue(entry.getValue().get(0) >= 0);
@@ -196,10 +197,10 @@ public class TestFavoredStochasticLoadBalancer extends BalancerTestBase {
     admin.disableTable(TableName.valueOf(tableName));
     admin.deleteTable(TableName.valueOf(tableName));
     replicaLoadMap = fnm.getReplicaLoad(Lists.newArrayList(
-      admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).getServers()));
+      admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics().keySet()));
     assertTrue("replica load found " + replicaLoadMap.size() + " instead of 0.",
       replicaLoadMap.size() == admin
-          .getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).getServers()
+          .getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics()
           .size());
   }
 
@@ -220,7 +221,8 @@ public class TestFavoredStochasticLoadBalancer extends BalancerTestBase {
 
     LoadBalancer balancer = master.getLoadBalancer();
     ServerName destination = balancer.randomAssignment(hri, Lists.newArrayList(admin
-        .getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).getServers()));
+        .getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics()
+        .keySet().stream().collect(Collectors.toList())));
     assertNotNull(destination);
     List<ServerName> favoredNodes = fnm.getFavoredNodes(hri);
     assertNotNull(favoredNodes);
@@ -286,7 +288,8 @@ public class TestFavoredStochasticLoadBalancer extends BalancerTestBase {
     assertNotNull(currentFN);
 
     List<ServerName> serversForNewFN = Lists.newArrayList();
-    for (ServerName sn : admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).getServers()) {
+    for (ServerName sn : admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS))
+      .getLiveServerMetrics().keySet()) {
       serversForNewFN.add(ServerName.valueOf(sn.getHostname(), sn.getPort(), NON_STARTCODE));
     }
     for (ServerName sn : currentFN) {
@@ -386,7 +389,8 @@ public class TestFavoredStochasticLoadBalancer extends BalancerTestBase {
 
     // Regenerate FN and assign, everything else should be fine
     List<ServerName> serversForNewFN = Lists.newArrayList();
-    for (ServerName sn : admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).getServers()) {
+    for (ServerName sn : admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS))
+      .getLiveServerMetrics().keySet()) {
       serversForNewFN.add(ServerName.valueOf(sn.getHostname(), sn.getPort(), NON_STARTCODE));
     }
 
@@ -480,7 +484,8 @@ public class TestFavoredStochasticLoadBalancer extends BalancerTestBase {
 
     // Regenerate FN and assign, everything else should be fine
     List<ServerName> serversForNewFN = Lists.newArrayList();
-    for (ServerName sn : admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).getServers()) {
+    for (ServerName sn : admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS))
+      .getLiveServerMetrics().keySet()) {
       serversForNewFN.add(ServerName.valueOf(sn.getHostname(), sn.getPort(), NON_STARTCODE));
     }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionLocationFinder.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionLocationFinder.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionLocationFinder.java
index 0b49b5e..0479065 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionLocationFinder.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionLocationFinder.java
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertTrue;
 
 import java.util.ArrayList;
 import java.util.List;
-
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HDFSBlocksDistribution;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
@@ -69,7 +68,7 @@ public class TestRegionLocationFinder {
 
     finder.setConf(TEST_UTIL.getConfiguration());
     finder.setServices(cluster.getMaster());
-    finder.setClusterStatus(cluster.getMaster().getClusterStatus());
+    finder.setClusterMetrics(cluster.getMaster().getClusterMetrics());
   }
 
   @AfterClass

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStochasticLoadBalancer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStochasticLoadBalancer.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStochasticLoadBalancer.java
index 1e6f1dd..a326d9a 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStochasticLoadBalancer.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStochasticLoadBalancer.java
@@ -25,7 +25,6 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -33,13 +32,13 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Queue;
 import java.util.TreeMap;
-
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.ClusterStatus;
+import org.apache.hadoop.hbase.ClusterMetrics;
 import org.apache.hadoop.hbase.HBaseConfiguration;
-import org.apache.hadoop.hbase.RegionLoad;
-import org.apache.hadoop.hbase.ServerLoad;
+import org.apache.hadoop.hbase.RegionMetrics;
+import org.apache.hadoop.hbase.ServerMetrics;
 import org.apache.hadoop.hbase.ServerName;
+import org.apache.hadoop.hbase.Size;
 import org.apache.hadoop.hbase.client.RegionInfo;
 import org.apache.hadoop.hbase.client.RegionReplicaUtil;
 import org.apache.hadoop.hbase.master.MockNoopMasterServices;
@@ -126,20 +125,25 @@ public class TestStochasticLoadBalancer extends BalancerTestBase {
     ServerName sn = ServerName.valueOf("test:8080", 100);
     int numClusterStatusToAdd = 20000;
     for (int i = 0; i < numClusterStatusToAdd; i++) {
-      ServerLoad sl = mock(ServerLoad.class);
+      ServerMetrics sl = mock(ServerMetrics.class);
 
-      RegionLoad rl = mock(RegionLoad.class);
-      when(rl.getStorefileSizeMB()).thenReturn(i);
+      RegionMetrics rl = mock(RegionMetrics.class);
+      when(rl.getReadRequestCount()).thenReturn(0L);
+      when(rl.getWriteRequestCount()).thenReturn(0L);
+      when(rl.getMemStoreSize()).thenReturn(Size.ZERO);
+      when(rl.getStoreFileSize()).thenReturn(new Size(i, Size.Unit.MEGABYTE));
 
-      Map<byte[], RegionLoad> regionLoadMap = new TreeMap<>(Bytes.BYTES_COMPARATOR);
+      Map<byte[], RegionMetrics> regionLoadMap = new TreeMap<>(Bytes.BYTES_COMPARATOR);
       regionLoadMap.put(Bytes.toBytes(REGION_KEY), rl);
-      when(sl.getRegionsLoad()).thenReturn(regionLoadMap);
+      when(sl.getRegionMetrics()).thenReturn(regionLoadMap);
 
-      ClusterStatus clusterStatus = mock(ClusterStatus.class);
-      when(clusterStatus.getServers()).thenReturn(Arrays.asList(sn));
-      when(clusterStatus.getLoad(sn)).thenReturn(sl);
+      ClusterMetrics clusterStatus = mock(ClusterMetrics.class);
+      Map<ServerName, ServerMetrics> serverMetricsMap = new TreeMap<>();
+      serverMetricsMap.put(sn, sl);
+      when(clusterStatus.getLiveServerMetrics()).thenReturn(serverMetricsMap);
+//      when(clusterStatus.getLoad(sn)).thenReturn(sl);
 
-      loadBalancer.setClusterStatus(clusterStatus);
+      loadBalancer.setClusterMetrics(clusterStatus);
     }
     assertTrue(loadBalancer.loads.get(REGION_KEY) != null);
     assertTrue(loadBalancer.loads.get(REGION_KEY).size() == 15);

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReadRequestMetrics.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReadRequestMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReadRequestMetrics.java
index e7b35d9..536fdb2 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReadRequestMetrics.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReadRequestMetrics.java
@@ -106,7 +106,8 @@ public class TestRegionServerReadRequestMetrics {
     TEST_UTIL.getConfiguration().setBoolean(LoadBalancer.SYSTEM_TABLES_ON_MASTER, true);
     TEST_UTIL.startMiniCluster();
     admin = TEST_UTIL.getAdmin();
-    serverNames = admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).getServers();
+    serverNames = admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS))
+      .getLiveServerMetrics().keySet();
     table = createTable();
     putData();
     List<RegionInfo> regions = admin.getRegions(TABLE_NAME);
@@ -166,7 +167,8 @@ public class TestRegionServerReadRequestMetrics {
     boolean metricsUpdated = false;
     for (int i = 0; i < MAX_TRY; i++) {
       for (ServerName serverName : serverNames) {
-        serverLoad = admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).getLoad(serverName);
+        serverLoad = new ServerLoad(admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS))
+          .getLiveServerMetrics().get(serverName));
 
         Map<byte[], RegionLoad> regionsLoad = serverLoad.getRegionsLoad();
         RegionLoad regionLoad = regionsLoad.get(regionInfo.getRegionName());
@@ -442,8 +444,8 @@ public class TestRegionServerReadRequestMetrics {
 
   private void testReadRequests(byte[] regionName, int expectedReadRequests) throws Exception {
     for (ServerName serverName : serverNames) {
-      ServerLoad serverLoad =
-          admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).getLoad(serverName);
+      ServerLoad serverLoad = new ServerLoad(admin.getClusterMetrics(
+        EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics().get(serverName));
       Map<byte[], RegionLoad> regionsLoad = serverLoad.getRegionsLoad();
       RegionLoad regionLoad = regionsLoad.get(regionName);
       if (regionLoad != null) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
index 4c66b79..ab2d4b4 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
@@ -33,7 +33,6 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicBoolean;
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -904,13 +903,14 @@ public class TestSplitTransactionOnCluster {
 
   private void waitUntilRegionServerDead() throws InterruptedException, IOException {
     // Wait until the master processes the RS shutdown
-    for (int i=0; (cluster.getMaster().getClusterStatus().getServers().size() > NB_SERVERS
+    for (int i=0; (cluster.getMaster().getClusterMetrics()
+        .getLiveServerMetrics().size() > NB_SERVERS
         || cluster.getLiveRegionServerThreads().size() > NB_SERVERS) && i<100; i++) {
       LOG.info("Waiting on server to go down");
       Thread.sleep(100);
     }
     assertFalse("Waited too long for RS to die",
-      cluster.getMaster().getClusterStatus(). getServers().size() > NB_SERVERS
+      cluster.getMaster().getClusterMetrics(). getLiveServerMetrics().size() > NB_SERVERS
         || cluster.getLiveRegionServerThreads().size() > NB_SERVERS);
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java
index df929c8..1012720 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java
@@ -35,13 +35,12 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.ClusterMetrics;
-import org.apache.hadoop.hbase.ClusterStatus;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
-import org.apache.hadoop.hbase.ServerLoad;
+import org.apache.hadoop.hbase.ServerMetrics;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.Waiter;
@@ -187,9 +186,9 @@ public class TestMasterReplication {
     Waiter.waitFor(baseConfiguration, 10000, new Waiter.Predicate<Exception>() {
       @Override
       public boolean evaluate() throws Exception {
-        ClusterStatus clusterStatus = utilities[0].getAdmin()
-            .getClusterStatus(EnumSet.of(ClusterMetrics.Option.LIVE_SERVERS));
-        ServerLoad serverLoad = clusterStatus.getLoad(rsName);
+        ClusterMetrics clusterStatus = utilities[0].getAdmin()
+            .getClusterMetrics(EnumSet.of(ClusterMetrics.Option.LIVE_SERVERS));
+        ServerMetrics serverLoad = clusterStatus.getLiveServerMetrics().get(rsName);
         List<ReplicationLoadSource> replicationLoadSourceList =
             serverLoad.getReplicationLoadSourceList();
         return replicationLoadSourceList.isEmpty();

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStatus.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStatus.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStatus.java
index f76be44..7a624b2 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStatus.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStatus.java
@@ -67,7 +67,8 @@ public class TestReplicationStatus extends TestReplicationBase {
         htable1.put(p);
       }
 
-      ClusterStatus status = hbaseAdmin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS));
+      ClusterStatus status = new ClusterStatus(hbaseAdmin.getClusterMetrics(
+        EnumSet.of(Option.LIVE_SERVERS)));
 
       for (JVMClusterUtil.RegionServerThread thread : utility1.getHBaseCluster()
           .getRegionServerThreads()) {
@@ -90,7 +91,7 @@ public class TestReplicationStatus extends TestReplicationBase {
       // Stop rs1, then the queue of rs1 will be transfered to rs0
       utility1.getHBaseCluster().getRegionServer(1).stop("Stop RegionServer");
       Thread.sleep(10000);
-      status = hbaseAdmin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS));
+      status = new ClusterStatus(hbaseAdmin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)));
       ServerName server = utility1.getHBaseCluster().getRegionServer(0).getServerName();
       ServerLoad sl = status.getLoad(server);
       List<ReplicationLoadSource> rLoadSourceList = sl.getReplicationLoadSourceList();

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
index 83a6dfd..2435532 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
@@ -120,8 +120,6 @@ import org.apache.hadoop.hbase.replication.ReplicationPeerConfig;
 import org.apache.hadoop.hbase.security.Superusers;
 import org.apache.hadoop.hbase.security.User;
 import org.apache.hadoop.hbase.security.access.Permission.Action;
-import org.apache.hadoop.hbase.shaded.ipc.protobuf.generated.TestProcedureProtos;
-import org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.ProcedureState;
 import org.apache.hadoop.hbase.testclassification.LargeTests;
 import org.apache.hadoop.hbase.testclassification.SecurityTests;
 import org.apache.hadoop.hbase.tool.LoadIncrementalHFiles;
@@ -137,6 +135,9 @@ import org.junit.rules.TestName;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.apache.hadoop.hbase.shaded.ipc.protobuf.generated.TestProcedureProtos;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.ProcedureState;
+
 /**
  * Performs authorization checks for common operations, according to different
  * levels of authorized users.
@@ -3129,7 +3130,7 @@ public class TestAccessController extends SecureTestUtil {
     AccessTestAction action = new AccessTestAction() {
       @Override
       public Object run() throws Exception {
-        ACCESS_CONTROLLER.preGetClusterStatus(ObserverContextImpl.createAndPrepare(CP_ENV));
+        ACCESS_CONTROLLER.preGetClusterMetrics(ObserverContextImpl.createAndPrepare(CP_ENV));
         return null;
       }
     };

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
index bb52b5f..5aca352 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import com.google.protobuf.ServiceException;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -29,7 +30,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FSDataOutputStream;
@@ -62,7 +62,6 @@ import org.apache.hadoop.hbase.mob.MobUtils;
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.HRegionFileSystem;
 import org.apache.hadoop.hbase.regionserver.HRegionServer;
-import org.apache.hadoop.hbase.regionserver.Region;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.FSTableDescriptors;
 import org.apache.hadoop.hbase.util.FSUtils;
@@ -72,14 +71,13 @@ import org.apache.yetus.audience.InterfaceAudience;
 import org.junit.Assert;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
 import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsSnapshotDoneRequest;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsSnapshotDoneResponse;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotRegionManifest;
 
-import com.google.protobuf.ServiceException;
-
 /**
  * Utilities class for snapshots
  */
@@ -229,9 +227,6 @@ public final class SnapshotTestingUtils {
         }
       });
     }
-    for (byte[] b : snapshotFamilies) {
-      LOG.info("[CHIA] " + Bytes.toStringBinary(b));
-    }
     // Verify that there are store files in the specified families
     if (nonEmptyTestFamilies != null) {
       for (final byte[] familyName: nonEmptyTestFamilies) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java
index 9e4de7e..87d718e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/BaseTestHBaseFsck.java
@@ -37,14 +37,13 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.ClusterMetrics;
 import org.apache.hadoop.hbase.ClusterMetrics.Option;
-import org.apache.hadoop.hbase.ClusterStatus;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionLocation;
 import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.MetaTableAccessor;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
@@ -54,7 +53,6 @@ import org.apache.hadoop.hbase.client.ConnectionFactory;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.RegionInfo;
-import org.apache.hadoop.hbase.client.RegionInfoBuilder;
 import org.apache.hadoop.hbase.client.RegionLocator;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.client.Table;
@@ -319,8 +317,8 @@ public class BaseTestHBaseFsck {
    * Get region info from local cluster.
    */
   Map<ServerName, List<String>> getDeployedHRIs(final Admin admin) throws IOException {
-    ClusterStatus status = admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS));
-    Collection<ServerName> regionServers = status.getServers();
+    ClusterMetrics status = admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS));
+    Collection<ServerName> regionServers = status.getLiveServerMetrics().keySet();
     Map<ServerName, List<String>> mm = new HashMap<>();
     for (ServerName hsi : regionServers) {
       AdminProtos.AdminService.BlockingInterface server = connection.getAdmin(hsi);

http://git-wip-us.apache.org/repos/asf/hbase/blob/8119acfc/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java
index 0b9c4b5..3230e27 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java
@@ -153,8 +153,8 @@ public class TestMiniClusterLoadSequential {
         ", isMultiPut=" + isMultiPut);
     numKeys = numKeys();
     Admin admin = TEST_UTIL.getAdmin();
-    while (admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS))
-                .getServers().size() < NUM_RS) {
+    while (admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS))
+                .getLiveServerMetrics().size() < NUM_RS) {
       LOG.info("Sleeping until " + NUM_RS + " RSs are online");
       Threads.sleepWithoutInterrupt(1000);
     }


Mime
View raw message