You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by mb...@apache.org on 2016/10/19 20:25:43 UTC

hbase git commit: HBASE-16874 Fix TestMasterFailoverWithProcedures and ensure single proc-executor for kill/restart tests [Forced Update!]

Repository: hbase
Updated Branches:
  refs/heads/master 15946a0b4 -> d9ee25e82 (forced update)


HBASE-16874 Fix TestMasterFailoverWithProcedures and ensure single proc-executor for kill/restart tests


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

Branch: refs/heads/master
Commit: d9ee25e82a13d7df1ae097e0f3ae6d12dc9e94fa
Parents: 82a2384
Author: Matteo Bertozzi <ma...@cloudera.com>
Authored: Wed Oct 19 13:06:48 2016 -0700
Committer: Matteo Bertozzi <ma...@cloudera.com>
Committed: Wed Oct 19 13:25:17 2016 -0700

----------------------------------------------------------------------
 .../hbase/procedure2/ProcedureTestingUtility.java      | 13 +++++++++++++
 .../procedure/TestMasterFailoverWithProcedures.java    |  1 +
 2 files changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/d9ee25e8/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/ProcedureTestingUtility.java
----------------------------------------------------------------------
diff --git a/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/ProcedureTestingUtility.java b/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/ProcedureTestingUtility.java
index 2d27c59..968ccbf 100644
--- a/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/ProcedureTestingUtility.java
+++ b/hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/ProcedureTestingUtility.java
@@ -115,6 +115,7 @@ public class ProcedureTestingUtility {
     }
     procExecutor.testing.killBeforeStoreUpdate = value;
     LOG.warn("Set Kill before store update to: " + procExecutor.testing.killBeforeStoreUpdate);
+    assertSingleExecutorForKillTests(procExecutor);
   }
 
   public static <TEnv> void setToggleKillBeforeStoreUpdate(ProcedureExecutor<TEnv> procExecutor,
@@ -123,6 +124,7 @@ public class ProcedureTestingUtility {
       procExecutor.testing = new ProcedureExecutor.Testing();
     }
     procExecutor.testing.toggleKillBeforeStoreUpdate = value;
+    assertSingleExecutorForKillTests(procExecutor);
   }
 
   public static <TEnv> void toggleKillBeforeStoreUpdate(ProcedureExecutor<TEnv> procExecutor) {
@@ -131,12 +133,23 @@ public class ProcedureTestingUtility {
     }
     procExecutor.testing.killBeforeStoreUpdate = !procExecutor.testing.killBeforeStoreUpdate;
     LOG.warn("Set Kill before store update to: " + procExecutor.testing.killBeforeStoreUpdate);
+    assertSingleExecutorForKillTests(procExecutor);
   }
 
   public static <TEnv> void setKillAndToggleBeforeStoreUpdate(ProcedureExecutor<TEnv> procExecutor,
       boolean value) {
     ProcedureTestingUtility.setKillBeforeStoreUpdate(procExecutor, value);
     ProcedureTestingUtility.setToggleKillBeforeStoreUpdate(procExecutor, value);
+    assertSingleExecutorForKillTests(procExecutor);
+  }
+
+  private static <TEnv> void assertSingleExecutorForKillTests(final ProcedureExecutor<TEnv> procExecutor) {
+    if (procExecutor.testing == null) return;
+    if (procExecutor.testing.killBeforeStoreUpdate ||
+        procExecutor.testing.toggleKillBeforeStoreUpdate) {
+      assertEquals("expected only one executor running during test with kill/restart",
+        1, procExecutor.getCorePoolSize());
+    }
   }
 
   public static <TEnv> long submitAndWait(Configuration conf, TEnv env, Procedure<TEnv> proc)

http://git-wip-us.apache.org/repos/asf/hbase/blob/d9ee25e8/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterFailoverWithProcedures.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterFailoverWithProcedures.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterFailoverWithProcedures.java
index 73134bb..e4f42d6 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterFailoverWithProcedures.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterFailoverWithProcedures.java
@@ -67,6 +67,7 @@ public class TestMasterFailoverWithProcedures {
     conf.setInt(WALProcedureStore.WAIT_BEFORE_ROLL_CONF_KEY, 0);
     conf.setInt(WALProcedureStore.ROLL_RETRIES_CONF_KEY, 1);
     conf.setInt(WALProcedureStore.MAX_SYNC_FAILURE_ROLL_CONF_KEY, 1);
+    conf.setInt(MasterProcedureConstants.MASTER_PROCEDURE_THREADS, 1);
   }
 
   @Before