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 23:00:17 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.0 65c85141b -> 035510231


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/03551023
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/03551023
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/03551023

Branch: refs/heads/branch-1.0
Commit: 0355102313b3660f18f179fd3949dc14e6f03b4e
Parents: 65c8514
Author: Andrey Stepachev <octo47@gmail.com>
Authored: Wed Mar 25 23:00:12 2015 +0000
Committer: Andrey Stepachev <octo47@gmail.com>
Committed: Wed Mar 25 23:00:12 2015 +0000

----------------------------------------------------------------------
 .../hadoop/hbase/master/AssignmentManager.java  |  7 ++++++
 .../master/handler/TestEnableTableHandler.java  | 24 +++++++++++++++++---
 2 files changed, 28 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/03551023/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 98883c1..7a64dd6 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
@@ -2854,6 +2854,13 @@ public class AssignmentManager extends ZooKeeperListener {
         State state = RegionStateStore.getRegionState(result, replicaId);
         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/03551023/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 39b347d..5e29809 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
@@ -18,7 +18,6 @@
  */
 package org.apache.hadoop.hbase.master.handler;
 
-import java.util.Collections;
 import java.util.List;
 
 import org.apache.commons.logging.Log;
@@ -29,14 +28,12 @@ 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.HBaseAdmin;
 import org.apache.hadoop.hbase.master.HMaster;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.FSTableDescriptors;
 import org.apache.hadoop.hbase.util.JVMClusterUtil;
 import org.junit.After;
 import org.junit.Before;
@@ -108,6 +105,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