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-18014 A case of Region remain unassigned when table enabled (Allan Yang)
Date Sat, 13 May 2017 00:46:20 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.3 72edf521c -> 36ebe05fc


HBASE-18014 A case of Region remain unassigned when table enabled (Allan Yang)


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

Branch: refs/heads/branch-1.3
Commit: 36ebe05fc9013fe27ba0eca410ed11e5c5b112cb
Parents: 72edf52
Author: Andrew Purtell <apurtell@apache.org>
Authored: Fri May 12 16:59:38 2017 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Fri May 12 17:46:12 2017 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/master/AssignmentManager.java  |  2 ++
 .../apache/hadoop/hbase/client/TestAdmin2.java  | 35 ++++++++++++++++++++
 2 files changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/36ebe05f/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 1e19397..d247b11 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
@@ -1561,6 +1561,8 @@ public class AssignmentManager extends ZooKeeperListener {
         EventType.RS_ZK_REGION_CLOSED, EventType.M_ZK_REGION_OFFLINE);
     }
     replicasToClose.remove(regionInfo);
+    //Set servername in regionstate to null, see HBASE-18014
+    getRegionStates().updateRegionState(regionInfo, State.OFFLINE, null);
     regionOffline(regionInfo);
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/36ebe05f/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
index 051998b..72f41a76 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin2.java
@@ -88,6 +88,12 @@ public class TestAdmin2 {
     TEST_UTIL.getConfiguration().setInt("hbase.regionserver.metahandler.count", 30);
     TEST_UTIL.getConfiguration().setBoolean(
         "hbase.master.enabletable.roundrobin", true);
+    //Set a very short keeptime for processedServers, see HBASE-18014
+    TEST_UTIL.getConfiguration().setLong("hbase.master.maximum.logsplit.keeptime", 100);
+    //HBASE-18014, don't Know why @Test (timeout=30000) attribute doesn't work when
+    //calling enableTable.So I have to set the sync wait time to a short time to timeout
+    //the test of testEnableTableAfterprocessedServersCleaned
+    TEST_UTIL.getConfiguration().setInt("hbase.client.sync.wait.timeout.msec", 30000);
     TEST_UTIL.startMiniCluster(3);
   }
 
@@ -790,4 +796,33 @@ public class TestAdmin2 {
     // Current state should be the original state again
     assertEquals(initialState, admin.isNormalizerEnabled());
   }
+
+  /**
+   * a UT for HBASE-18014
+   * @throws Exception
+   */
+  @Test (timeout=30000)
+  public void testEnableTableAfterprocessedServersCleaned() throws Exception {
+    String TABLENAME = "testEnableTableAfterprocessedServersCleaned";
+    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    HTableDescriptor hds = new HTableDescriptor(TableName.valueOf(TABLENAME));
+    HColumnDescriptor hcs = new HColumnDescriptor("cf".getBytes());
+    hds.addFamily(hcs);
+    admin.createTable(hds);
+    HRegionServer server = TEST_UTIL.getHBaseCluster().getRegionServer(0);
+    ServerName serverName = server.getServerName();
+    HRegionInfo region = admin.getTableRegions(TableName.valueOf(TABLENAME)).get(0);
+    //move the region to the first server so we can abort this rs
+    admin.move(region.getEncodedNameAsBytes(), Bytes.toBytes(serverName.toString()));
+    TEST_UTIL.waitUntilAllRegionsAssigned(TableName.valueOf(TABLENAME));
+    admin.disableTable(TABLENAME);
+    server.abort("abort");
+    //wait for SSH to handle server shutdown
+    Thread.sleep(5000);
+    //trigger a clean of processedServers
+    TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager()
+        .getRegionStates().logSplit(ServerName.valueOf("fakeServer", 5000, 0));
+    admin.enableTable(TABLENAME);
+    TEST_UTIL.waitUntilAllRegionsAssigned(TableName.valueOf(TABLENAME), 10000);
+  }
 }


Mime
View raw message