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-18193 Master web UI presents the incorrect number of regions
Date Fri, 09 Jun 2017 06:45:06 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 61839d714 -> 30817b922


HBASE-18193 Master web UI presents the incorrect number of regions


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

Branch: refs/heads/master
Commit: 30817b922ed72ba5630d8cea3d26bba9fef346e4
Parents: 61839d7
Author: Chia-Ping Tsai <chia7712@gmail.com>
Authored: Thu Jun 8 16:16:56 2017 +0800
Committer: Chia-Ping Tsai <chia7712@gmail.com>
Committed: Fri Jun 9 14:44:51 2017 +0800

----------------------------------------------------------------------
 .../hbase/master/assignment/RegionStates.java    |  4 +++-
 .../hbase/client/TestAsyncRegionAdminApi.java    | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/30817b92/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java
index 082e171..32be134 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java
@@ -686,7 +686,9 @@ public class RegionStates {
     }
 
     for (RegionStateNode node: regionsMap.values()) {
-      tableRegions.get(node.getState()).add(node.getRegionInfo());
+      if (node.getTable().equals(tableName)) {
+        tableRegions.get(node.getState()).add(node.getRegionInfo());
+      }
     }
     return tableRegions;
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/30817b92/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java
index 17a6d9b..3bdd5fd 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionAdminApi.java
@@ -417,6 +417,25 @@ public class TestAsyncRegionAdminApi extends TestAsyncAdminBase {
   }
 
   @Test
+  public void testGetRegionByStateOfTable() throws Exception {
+    final TableName tableName = TableName.valueOf("testGetRegionByStateOfTable");
+    try {
+      HRegionInfo hri = createTableAndGetOneRegion(tableName);
+
+      RegionStates regionStates =
+          TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager().getRegionStates();
+      assertTrue(regionStates.getRegionByStateOfTable(tableName)
+              .get(RegionState.State.OPEN)
+              .contains(hri));
+      assertFalse(regionStates.getRegionByStateOfTable(TableName.valueOf("I_am_the_phantom"))
+              .get(RegionState.State.OPEN)
+              .contains(hri));
+    } finally {
+      TEST_UTIL.deleteTable(tableName);
+    }
+  }
+
+  @Test
   public void testMoveRegion() throws Exception {
     final TableName tableName = TableName.valueOf("testMoveRegion");
     try {


Mime
View raw message