hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mberto...@apache.org
Subject [1/2] hbase git commit: HBASE-17030 Procedure v2 - A couple of tweaks to the SplitTableRegionProcedure
Date Tue, 08 Nov 2016 18:41:56 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 76814e845 -> b143f6e4a


http://git-wip-us.apache.org/repos/asf/hbase/blob/b143f6e4/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestSplitTableRegionProcedure.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestSplitTableRegionProcedure.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestSplitTableRegionProcedure.java
index 147c354..fcce0fb 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestSplitTableRegionProcedure.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestSplitTableRegionProcedure.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.master.procedure;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.io.IOException;
 import java.util.List;
@@ -29,6 +30,7 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.CellUtil;
+import org.apache.hadoop.hbase.DoNotRetryIOException;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
@@ -129,8 +131,7 @@ public class TestSplitTableRegionProcedure {
 
     // Split region of the table
     long procId = procExec.submitProcedure(
-      new SplitTableRegionProcedure(
-        procExec.getEnvironment(), tableName, regions[0], splitKey),
+      new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey),
       nonceGroup,
       nonce);
     // Wait the completion
@@ -155,8 +156,7 @@ public class TestSplitTableRegionProcedure {
 
     // Split region of the table
     long procId = procExec.submitProcedure(
-      new SplitTableRegionProcedure(
-        procExec.getEnvironment(), tableName, regions[0], splitKey),
+      new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey),
       nonceGroup,
       nonce);
     // Wait the completion
@@ -184,8 +184,7 @@ public class TestSplitTableRegionProcedure {
 
     // Split region of the table
     long procId = procExec.submitProcedure(
-      new SplitTableRegionProcedure(
-        procExec.getEnvironment(), tableName, regions[0], splitKey),
+      new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey),
       nonceGroup,
       nonce);
     // Wait the completion
@@ -212,8 +211,7 @@ public class TestSplitTableRegionProcedure {
 
     // Split region of the table
     long procId = procExec.submitProcedure(
-      new SplitTableRegionProcedure(
-        procExec.getEnvironment(), tableName, regions[0], splitKey),
+      new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey),
       nonceGroup,
       nonce);
     // Wait the completion
@@ -245,8 +243,7 @@ public class TestSplitTableRegionProcedure {
 
     // Split region of the table
     long procId = procExec.submitProcedure(
-      new SplitTableRegionProcedure(
-        procExec.getEnvironment(), tableName, regions[0], splitKey),
+      new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey),
       nonceGroup,
       nonce);
     // Wait the completion
@@ -286,14 +283,12 @@ public class TestSplitTableRegionProcedure {
 
     // Split region of the table
     long procId1 = procExec.submitProcedure(
-      new SplitTableRegionProcedure(
-        procExec.getEnvironment(), tableName, regions[0], splitKey),
+      new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey),
       nonceGroup,
       nonce);
     // Split region of the table with the same nonce
     long procId2 = procExec.submitProcedure(
-      new SplitTableRegionProcedure(
-        procExec.getEnvironment(), tableName, regions[0], splitKey),
+      new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey),
       nonceGroup,
       nonce);
 
@@ -323,15 +318,16 @@ public class TestSplitTableRegionProcedure {
     assertTrue("not able to find a splittable region", regions.length == 1);
 
     // Split region of the table with null split key
-    long procId1 = procExec.submitProcedure(
-      new SplitTableRegionProcedure(procExec.getEnvironment(), tableName, regions[0], null),
-      nonceGroup,
-      nonce);
-    ProcedureTestingUtility.waitProcedure(procExec, procId1);
-    ProcedureInfo result = procExec.getResult(procId1);
-    assertTrue(result.isFailed());
-    LOG.debug("Split failed with exception: " + result.getExceptionFullMessage());
-    assertTrue(UTIL.getMiniHBaseCluster().getRegions(tableName).size() == 1);
+    try {
+      long procId1 = procExec.submitProcedure(
+        new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], null),
+        nonceGroup,
+        nonce);
+      ProcedureTestingUtility.waitProcedure(procExec, procId1);
+      fail("unexpected procedure start with invalid split-key");
+    } catch (DoNotRetryIOException e) {
+      LOG.debug("Expected Split procedure construction failure: " + e.getMessage());
+    }
   }
 
   @Test(timeout = 600000)
@@ -352,7 +348,7 @@ public class TestSplitTableRegionProcedure {
 
     // Split region of the table
     long procId = procExec.submitProcedure(
-      new SplitTableRegionProcedure(procExec.getEnvironment(), tableName, regions[0], splitKey),
+      new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey),
       nonceGroup,
       nonce);
 
@@ -385,7 +381,7 @@ public class TestSplitTableRegionProcedure {
 
     // Split region of the table
     long procId = procExec.submitProcedure(
-      new SplitTableRegionProcedure(procExec.getEnvironment(), tableName, regions[0], splitKey),
+      new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0], splitKey),
       nonceGroup,
       nonce);
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/b143f6e4/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
index dd79e39..495da8f 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
@@ -91,7 +91,6 @@ import org.apache.hadoop.hbase.util.FSUtils;
 import org.apache.hadoop.hbase.util.HBaseFsck;
 import org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread;
 import org.apache.hadoop.hbase.util.Threads;
-import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.KeeperException.NodeExistsException;
 import org.junit.After;
@@ -481,23 +480,6 @@ public class TestSplitTransactionOnCluster {
   }
 
   /**
-   * Noop Abortable implementation used below in tests.
-   */
-  static class UselessTestAbortable implements Abortable {
-    boolean aborted = false;
-    @Override
-    public void abort(String why, Throwable e) {
-      LOG.warn("ABORTED (But nothing to abort): why=" + why, e);
-      aborted = true;
-    }
-
-    @Override
-    public boolean isAborted() {
-      return this.aborted;
-    }
-  }
-
-  /**
    * Verifies HBASE-5806.  Here the case is that splitting is completed but before the
    * CJ could remove the parent region the master is killed and restarted.
    * @throws IOException
@@ -523,8 +505,6 @@ public class TestSplitTransactionOnCluster {
     this.admin.setBalancerRunning(false, true);
     // Turn off the meta scanner so it don't remove parent on us.
     cluster.getMaster().setCatalogJanitorEnabled(false);
-    ZooKeeperWatcher zkw = new ZooKeeperWatcher(t.getConfiguration(),
-      "testMasterRestartAtRegionSplitPendingCatalogJanitor", new UselessTestAbortable());
     try {
       // Add a bit of load up into the table so splittable.
       TESTING_UTIL.loadTable(t, HConstants.CATALOG_FAMILY, false);
@@ -552,7 +532,6 @@ public class TestSplitTransactionOnCluster {
       this.admin.setBalancerRunning(true, false);
       cluster.getMaster().setCatalogJanitorEnabled(true);
       t.close();
-      zkw.close();
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/b143f6e4/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckOneRS.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckOneRS.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckOneRS.java
index 732e387..fcd5258 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckOneRS.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckOneRS.java
@@ -1712,7 +1712,7 @@ public class TestHBaseFsckOneRS extends BaseTestHBaseFsck {
       // Create daughters without adding to META table
       MasterProcedureEnv env = cluster.getMaster().getMasterProcedureExecutor().getEnvironment();
       SplitTableRegionProcedure splitR = new SplitTableRegionProcedure(
-        env, desc.getTableName(), regions.get(0).getRegionInfo(), Bytes.toBytes("r3"));
+        env, regions.get(0).getRegionInfo(), Bytes.toBytes("r3"));
       splitR.prepareSplitRegion(env);
       splitR.setRegionStateToSplitting(env);
       splitR.closeParentRegionForSplit(env);


Mime
View raw message