hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oct...@apache.org
Subject hbase git commit: HBASE-13326 Disabled table can't be enabled after HBase is restarted
Date Wed, 25 Mar 2015 22:57:43 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 46e782927 -> 9df1c244a


HBASE-13326 Disabled table can't be enabled after HBase is restarted


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

Branch: refs/heads/branch-1
Commit: 9df1c244a07c2c750f59d798d074adbbf9bee8b4
Parents: 46e7829
Author: Andrey Stepachev <octo47@gmail.com>
Authored: Wed Mar 25 22:57:37 2015 +0000
Committer: Andrey Stepachev <octo47@gmail.com>
Committed: Wed Mar 25 22:57:37 2015 +0000

----------------------------------------------------------------------
 .../hadoop/hbase/master/AssignmentManager.java  |  7 +++++++
 .../master/handler/TestEnableTableHandler.java  | 22 +++++++++++++++++++-
 2 files changed, 28 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/9df1c244/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
index 3e895b4..b1a1cc7 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
@@ -2893,6 +2893,13 @@ public class AssignmentManager extends ZooKeeperListener {
         }
         ServerName lastHost = hrl.getServerName();
         ServerName regionLocation = RegionStateStore.getRegionServer(result, replicaId);
+        if (tableStateManager.isTableState(regionInfo.getTable(),
+             ZooKeeperProtos.Table.State.DISABLED)) {
+          // force region to forget it hosts for disabled/disabling tables.
+          // see HBASE-13326
+          lastHost = null;
+          regionLocation = null;
+        }
         regionStates.createRegionState(regionInfo, state, regionLocation, lastHost);
         if (!regionStates.isRegionInState(regionInfo, State.OPEN)) {
           // Region is not open (either offline or in transition), skip

http://git-wip-us.apache.org/repos/asf/hbase/blob/9df1c244/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java
index 87b6e9b..4f97a2e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/handler/TestEnableTableHandler.java
@@ -30,7 +30,6 @@ import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.hbase.MetaTableAccessor;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Delete;
@@ -112,6 +111,27 @@ public class TestEnableTableHandler {
     assertEquals(tableName, onlineRegions.get(1).getTable());
   }
 
+
+  @Test(timeout = 300000)
+  public void testDisableTableAndRestart() throws Exception {
+    final TableName tableName = TableName.valueOf("testDisableTableAndRestart");
+    final MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
+    final HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    final HTableDescriptor desc = new HTableDescriptor(tableName);
+    desc.addFamily(new HColumnDescriptor(FAMILYNAME));
+    admin.createTable(desc);
+    admin.disableTable(tableName);
+    TEST_UTIL.waitTableDisabled(tableName.getName());
+
+    TEST_UTIL.getHBaseCluster().shutdown();
+    TEST_UTIL.getHBaseCluster().waitUntilShutDown();
+
+    TEST_UTIL.restartHBaseCluster(2);
+
+    admin.enableTable(tableName);
+    TEST_UTIL.waitTableEnabled(tableName);
+  }
+
   /**
    * We were only clearing rows that had a hregioninfo column in hbase:meta.  Mangled rows
that
    * were missing the hregioninfo because of error were being left behind messing up any


Mime
View raw message