hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chia7...@apache.org
Subject hbase git commit: HBASE-19141 [compat 1-2] getClusterStatus always return empty ClusterStatus
Date Wed, 01 Nov 2017 17:02:04 GMT
Repository: hbase
Updated Branches:
  refs/heads/master f10f4eb12 -> 2d0da40ff


HBASE-19141 [compat 1-2] getClusterStatus always return empty ClusterStatus

Signed-off-by: Chia-Ping Tsai <chia7712@gmail.com>


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

Branch: refs/heads/master
Commit: 2d0da40fff2d3b4873c610015e948ef9167ac202
Parents: f10f4eb
Author: Chia-Ping Tsai <chia7712@gmail.com>
Authored: Wed Nov 1 07:41:15 2017 +0800
Committer: Chia-Ping Tsai <chia7712@gmail.com>
Committed: Thu Nov 2 00:56:37 2017 +0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/master/HMaster.java |  6 +++++
 .../hbase/client/TestClientClusterStatus.java   | 23 ++++----------------
 2 files changed, 10 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/2d0da40f/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
index c5c86e5..3ba31da 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
@@ -2436,6 +2436,12 @@ public class HMaster extends HRegionServer implements MasterServices
{
    */
   public ClusterStatus getClusterStatus(EnumSet<Option> options) throws InterruptedIOException
{
     ClusterStatus.Builder builder = ClusterStatus.newBuilder();
+    // given that hbase1 can't submit the request with Option,
+    // we return all information to client if the list of Option is empty.
+    if (options.isEmpty()) {
+      options = EnumSet.allOf(Option.class);
+    }
+
     for (Option opt : options) {
       switch (opt) {
         case HBASE_VERSION: builder.setHBaseVersion(VersionInfo.getVersion()); break;

http://git-wip-us.apache.org/repos/asf/hbase/blob/2d0da40f/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
index 29028ec..2d31f98 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
@@ -20,11 +20,10 @@ package org.apache.hadoop.hbase.client;
 import java.util.EnumSet;
 import java.util.List;
 import java.util.concurrent.CompletableFuture;
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.ClusterStatus;
-import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.ClusterStatus.Option;
+import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
 import org.apache.hadoop.hbase.ServerName;
@@ -87,23 +86,9 @@ public class TestClientClusterStatus {
 
   @Test
   public void testNone() throws Exception {
-    ClusterStatus status = ADMIN.getClusterStatus(EnumSet.noneOf(Option.class));
-    // Other cluster status info should be either null or empty.
-    Assert.assertTrue(status.getMasterCoprocessors().length == 0);
-    Assert.assertNull(status.getHBaseVersion());
-    Assert.assertTrue(status.getBackupMasters().isEmpty());
-    Assert.assertNull(status.getBalancerOn());
-    Assert.assertNull(status.getClusterId());
-    Assert.assertTrue(status.getServers().isEmpty());
-    Assert.assertTrue(status.getDeadServerNames().isEmpty());
-    Assert.assertNull(status.getMaster());
-    Assert.assertTrue(status.getBackupMasters().isEmpty());
-    Assert.assertEquals(-1, status.getMasterInfoPort());
-    // No npe thrown is expected
-    Assert.assertNotNull(status.hashCode());
-    ClusterStatus nullEqualsCheck =
-        ADMIN.getClusterStatus(EnumSet.noneOf(Option.class));
-    Assert.assertTrue(status.equals(nullEqualsCheck));
+    ClusterStatus status0 = ADMIN.getClusterStatus(EnumSet.allOf(Option.class));
+    ClusterStatus status1 = ADMIN.getClusterStatus(EnumSet.noneOf(Option.class));
+    Assert.assertEquals(status0, status1);
   }
 
   @Test


Mime
View raw message