hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mberto...@apache.org
Subject hbase git commit: Fix TestMasterFailoverWithProcedures and ensure single proc-executor for kill/restart tests
Date Wed, 19 Oct 2016 20:24:07 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 82a238418 -> 15946a0b4


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

Branch: refs/heads/master
Commit: 15946a0b40103622f979eb0cf5a718939cfc56e7
Parents: 82a2384
Author: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Authored: Wed Oct 19 13:06:48 2016 -0700
Committer: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Committed: Wed Oct 19 13:14:04 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/15946a0b/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/15946a0b/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


Mime
View raw message