You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2017/11/08 01:38:55 UTC
hbase git commit: HBASE-19088 move_tables_rsgroup will throw an
exception when the table is disabled
Repository: hbase
Updated Branches:
refs/heads/master 46408e021 -> dc127df07
HBASE-19088 move_tables_rsgroup will throw an exception when the table is disabled
Signed-off-by: Andrew Purtell <ap...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/dc127df0
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/dc127df0
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/dc127df0
Branch: refs/heads/master
Commit: dc127df077490640a808d540fa56abbe888c9730
Parents: 46408e0
Author: Guangxu Cheng <gu...@gmail.com>
Authored: Mon Oct 30 16:57:10 2017 +0800
Committer: Andrew Purtell <ap...@apache.org>
Committed: Tue Nov 7 17:13:17 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/dc127df0/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/dc127df0/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);