hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject hbase git commit: HBASE-19088 move_tables_rsgroup will throw an exception when the table is disabled
Date Wed, 08 Nov 2017 01:39:09 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-2 e3bd47531 -> 8095f9628


HBASE-19088 move_tables_rsgroup will throw an exception when the table is disabled

Signed-off-by: Andrew Purtell <apurtell@apache.org>


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

Branch: refs/heads/branch-2
Commit: 8095f96289ac2fb1f5d9cd15b3ef55ddf791020f
Parents: e3bd475
Author: Guangxu Cheng <guangxucheng@gmail.com>
Authored: Mon Oct 30 16:57:10 2017 +0800
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Tue Nov 7 17:12:55 2017 -0800

----------------------------------------------------------------------
 .../hbase/rsgroup/RSGroupAdminServer.java       |  4 +++
 .../hadoop/hbase/rsgroup/TestRSGroupsBase.java  | 33 ++++++++++++++++++++
 2 files changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/8095f962/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java
----------------------------------------------------------------------
diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java
b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java
index 3c82d76..4a9a885 100644
--- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java
+++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java
@@ -406,6 +406,10 @@ public class RSGroupAdminServer implements RSGroupAdmin {
       // action is required.
       if (targetGroup != null) {
         for (TableName table: tables) {
+          if (master.getAssignmentManager().isTableDisabled(table)) {
+            LOG.debug("Skipping move regions because the table" + table + " is disabled.");
+            continue;
+          }
           for (RegionInfo region :
               master.getAssignmentManager().getRegionStates().getRegionsOfTable(table)) {
             LOG.info("Moving region " + region.getShortNameToLog() +

http://git-wip-us.apache.org/repos/asf/hbase/blob/8095f962/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBase.java
----------------------------------------------------------------------
diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBase.java
b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBase.java
index f0291fa..b225dad 100644
--- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBase.java
+++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBase.java
@@ -709,6 +709,39 @@ public abstract class TestRSGroupsBase {
   }
 
   @Test
+  public void testDisabledTableMove() throws Exception {
+    final byte[] familyNameBytes = Bytes.toBytes("f");
+    String newGroupName = getGroupName(name.getMethodName());
+    final RSGroupInfo newGroup = addGroup(newGroupName, 2);
+
+    TEST_UTIL.createMultiRegionTable(tableName, familyNameBytes, 5);
+    TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
+      @Override
+      public boolean evaluate() throws Exception {
+        List<String> regions = getTableRegionMap().get(tableName);
+        if (regions == null) {
+          return false;
+        }
+        return getTableRegionMap().get(tableName).size() >= 5;
+      }
+    });
+
+    RSGroupInfo tableGrp = rsGroupAdmin.getRSGroupInfoOfTable(tableName);
+    assertTrue(tableGrp.getName().equals(RSGroupInfo.DEFAULT_GROUP));
+
+    //test disable table
+    admin.disableTable(tableName);
+
+    //change table's group
+    LOG.info("Moving table "+ tableName + " to " + newGroup.getName());
+    rsGroupAdmin.moveTables(Sets.newHashSet(tableName), newGroup.getName());
+
+    //verify group change
+    Assert.assertEquals(newGroup.getName(),
+        rsGroupAdmin.getRSGroupInfoOfTable(tableName).getName());
+  }
+
+  @Test
   public void testMoveServersAndTables() throws Exception {
     LOG.info("testMoveServersAndTables");
     final RSGroupInfo newGroup = addGroup(getGroupName(name.getMethodName()), 1);


Mime
View raw message