HBASE-21854 Race condition in TestProcedureSkipPersistence

Signed-off-by: Peter Somogyi <psomogyi@apache.org>
This commit is contained in:
Duo Zhang 2019-02-11 16:33:14 +08:00 committed by Peter Somogyi
parent c48438fcb0
commit ebfde02343
1 changed files with 2 additions and 2 deletions

View File

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