List<Boolean> result = new ArrayList<Boolean>(pids.size()); for(long pid: pids) { result.add(bypassProcedure(pid, lockWait, force, recursive));
@Test public void testBypassingProcedureWithParentRecursive() throws Exception { final RootProcedure proc = new RootProcedure(); long rootId = procExecutor.submitProcedure(proc); htu.waitFor(5000, () -> procExecutor.getProcedures().stream() .filter(p -> p.getParentProcId() == rootId).collect(Collectors.toList()) .size() > 0); SuspendProcedure suspendProcedure = (SuspendProcedure)procExecutor.getProcedures().stream() .filter(p -> p.getParentProcId() == rootId).collect(Collectors.toList()).get(0); assertTrue(procExecutor.bypassProcedure(rootId, 1000, false, true)); htu.waitFor(5000, () -> proc.isSuccess() && proc.isBypass()); LOG.info("{} finished", proc); }
@Test public void testBypassingStuckStateMachineProcedure() throws Exception { final StuckStateMachineProcedure proc = new StuckStateMachineProcedure(procEnv, StuckStateMachineState.START); long id = procExecutor.submitProcedure(proc); Thread.sleep(500); // bypass the procedure assertFalse(procExecutor.bypassProcedure(id, 1000, false, false)); assertTrue(procExecutor.bypassProcedure(id, 1000, true, false)); htu.waitFor(5000, () -> proc.isSuccess() && proc.isBypass()); LOG.info("{} finished", proc); }
@Test public void testBypassingProcedureWithParent() throws Exception { final RootProcedure proc = new RootProcedure(); long rootId = procExecutor.submitProcedure(proc); htu.waitFor(5000, () -> procExecutor.getProcedures().stream() .filter(p -> p.getParentProcId() == rootId).collect(Collectors.toList()) .size() > 0); SuspendProcedure suspendProcedure = (SuspendProcedure)procExecutor.getProcedures().stream() .filter(p -> p.getParentProcId() == rootId).collect(Collectors.toList()).get(0); assertTrue(procExecutor.bypassProcedure(suspendProcedure.getProcId(), 1000, false, false)); htu.waitFor(5000, () -> proc.isSuccess() && proc.isBypass()); LOG.info("{} finished", proc); }
@Test public void testBypassingWaitingTimeoutProcedures() throws Exception { final WaitingTimeoutProcedure proc = new WaitingTimeoutProcedure(); long id = procExecutor.submitProcedure(proc); Thread.sleep(500); // bypass the procedure assertTrue(procExecutor.bypassProcedure(id, 1000, true, false)); htu.waitFor(5000, () -> proc.isSuccess() && proc.isBypass()); LOG.info("{} finished", proc); }
@Test public void testBypassSuspendProcedure() throws Exception { final SuspendProcedure proc = new SuspendProcedure(); long id = procExecutor.submitProcedure(proc); Thread.sleep(500); //bypass the procedure assertTrue(procExecutor.bypassProcedure(id, 30000, false, false)); htu.waitFor(5000, () -> proc.isSuccess() && proc.isBypass()); LOG.info("{} finished", proc); }
@Test public void testStuckProcedure() throws Exception { final StuckProcedure proc = new StuckProcedure(); long id = procExecutor.submitProcedure(proc); Thread.sleep(500); //bypass the procedure assertTrue(procExecutor.bypassProcedure(id, 1000, true, false)); //Since the procedure is stuck there, we need to restart the executor to recovery. ProcedureTestingUtility.restart(procExecutor); htu.waitFor(5000, () -> proc.isSuccess() && proc.isBypass()); LOG.info("{} finished", proc); }
bypassProcedure(v.getProcId(), lockWait, override, recursive); } catch (IOException e) { LOG.warn("Recursive bypass of pid={}", v.getProcId(), e);
/** * Bypass specified procedure to completion. Procedure is marked completed but no actual work * is done from the current state/ step onwards. Parents of the procedure are also marked for * bypass. * * NOTE: this is a dangerous operation and may be used to unstuck buggy procedures. This may * leave system in inconherent state. This may need to be followed by some cleanup steps/ * actions by operator. * * @return BypassProcedureToCompletionResponse indicating success or failure */ @Override public MasterProtos.BypassProcedureResponse bypassProcedure(RpcController controller, MasterProtos.BypassProcedureRequest request) throws ServiceException { try { List<Boolean> ret = master.getMasterProcedureExecutor().bypassProcedure(request.getProcIdList(), request.getWaitTime(), request.getOverride(), request.getRecursive()); return MasterProtos.BypassProcedureResponse.newBuilder().addAllBypassed(ret).build(); } catch (IOException e) { throw new ServiceException(e); } }
List<Boolean> result = new ArrayList<Boolean>(pids.size()); for(long pid: pids) { result.add(bypassProcedure(pid, lockWait, force, recursive));
@Test public void testBypassingProcedureWithParentRecursive() throws Exception { final RootProcedure proc = new RootProcedure(); long rootId = procExecutor.submitProcedure(proc); htu.waitFor(5000, () -> procExecutor.getProcedures().stream() .filter(p -> p.getParentProcId() == rootId).collect(Collectors.toList()) .size() > 0); SuspendProcedure suspendProcedure = (SuspendProcedure)procExecutor.getProcedures().stream() .filter(p -> p.getParentProcId() == rootId).collect(Collectors.toList()).get(0); assertTrue(procExecutor.bypassProcedure(rootId, 1000, false, true)); htu.waitFor(5000, () -> proc.isSuccess() && proc.isBypass()); LOG.info("{} finished", proc); }
@Test public void testBypassingProcedureWithParent() throws Exception { final RootProcedure proc = new RootProcedure(); long rootId = procExecutor.submitProcedure(proc); htu.waitFor(5000, () -> procExecutor.getProcedures().stream() .filter(p -> p.getParentProcId() == rootId).collect(Collectors.toList()) .size() > 0); SuspendProcedure suspendProcedure = (SuspendProcedure)procExecutor.getProcedures().stream() .filter(p -> p.getParentProcId() == rootId).collect(Collectors.toList()).get(0); assertTrue(procExecutor.bypassProcedure(suspendProcedure.getProcId(), 1000, false, false)); htu.waitFor(5000, () -> proc.isSuccess() && proc.isBypass()); LOG.info("{} finished", proc); }
@Test public void testBypassingStuckStateMachineProcedure() throws Exception { final StuckStateMachineProcedure proc = new StuckStateMachineProcedure(procEnv, StuckStateMachineState.START); long id = procExecutor.submitProcedure(proc); Thread.sleep(500); // bypass the procedure assertFalse(procExecutor.bypassProcedure(id, 1000, false, false)); assertTrue(procExecutor.bypassProcedure(id, 1000, true, false)); htu.waitFor(5000, () -> proc.isSuccess() && proc.isBypass()); LOG.info("{} finished", proc); }
@Test public void testBypassingWaitingTimeoutProcedures() throws Exception { final WaitingTimeoutProcedure proc = new WaitingTimeoutProcedure(); long id = procExecutor.submitProcedure(proc); Thread.sleep(500); // bypass the procedure assertTrue(procExecutor.bypassProcedure(id, 1000, true, false)); htu.waitFor(5000, () -> proc.isSuccess() && proc.isBypass()); LOG.info("{} finished", proc); }
@Test public void testBypassSuspendProcedure() throws Exception { final SuspendProcedure proc = new SuspendProcedure(); long id = procExecutor.submitProcedure(proc); Thread.sleep(500); //bypass the procedure assertTrue(procExecutor.bypassProcedure(id, 30000, false, false)); htu.waitFor(5000, () -> proc.isSuccess() && proc.isBypass()); LOG.info("{} finished", proc); }
@Test public void testStuckProcedure() throws Exception { final StuckProcedure proc = new StuckProcedure(); long id = procExecutor.submitProcedure(proc); Thread.sleep(500); //bypass the procedure assertTrue(procExecutor.bypassProcedure(id, 1000, true, false)); //Since the procedure is stuck there, we need to restart the executor to recovery. ProcedureTestingUtility.restart(procExecutor); htu.waitFor(5000, () -> proc.isSuccess() && proc.isBypass()); LOG.info("{} finished", proc); }
IOException ioe = null; try { result = bypassProcedure(v.getProcId(), lockWait, override, recursive); } catch (IOException e) { LOG.warn("Recursive bypass of pid={}", v.getProcId(), e);