HBASE-21854 Race condition in TestProcedureSkipPersistence
authorDuo Zhang <zhangduo@apache.org>
Mon, 11 Feb 2019 08:33:14 +0000 (16:33 +0800)
committerPeter Somogyi <psomogyi@apache.org>
Mon, 11 Feb 2019 13:54:45 +0000 (14:54 +0100)
Signed-off-by: Peter Somogyi <psomogyi@apache.org>
hbase-procedure/src/test/java/org/apache/hadoop/hbase/procedure2/TestProcedureSkipPersistence.java

index 8293dcb..2ddc732 100644 (file)
@@ -148,11 +148,11 @@ public class TestProcedureSkipPersistence {
   public void test() throws Exception {
     TestProcedure proc = new TestProcedure();
     long procId = procExecutor.submitProcedure(proc);
-    htu.waitFor(30000, () -> proc.isWaiting());
+    htu.waitFor(30000, () -> proc.isWaiting() && procExecutor.getActiveExecutorCount() == 0);
     ProcedureTestingUtility.restart(procExecutor);
     htu.waitFor(30000, () -> {
       Procedure<?> p = procExecutor.getProcedure(procId);
-      return p.isWaiting() || p.isFinished();
+      return (p.isWaiting() || p.isFinished()) && procExecutor.getActiveExecutorCount() == 0;
     });
     assertFalse(procExecutor.isFinished(procId));
     ProcedureTestingUtility.restart(procExecutor);