private void load(final boolean abortOnCorruption) throws IOException { Preconditions.checkArgument(completed.isEmpty(), "completed not empty"); Preconditions.checkArgument(rollbackStack.isEmpty(), "rollback state not empty"); Preconditions.checkArgument(procedures.isEmpty(), "procedure map not empty"); Preconditions.checkArgument(scheduler.size() == 0, "run queue not empty"); store.load(new ProcedureStore.ProcedureLoader() { @Override public void setMaxProcId(long maxProcId) { assert lastProcId.get() < 0 : "expected only one call to setMaxProcId()"; lastProcId.set(maxProcId); } @Override public void load(ProcedureIterator procIter) throws IOException { loadProcedures(procIter, abortOnCorruption); } @Override public void handleCorrupted(ProcedureIterator procIter) throws IOException { int corruptedCount = 0; while (procIter.hasNext()) { Procedure<?> proc = procIter.next(); LOG.error("Corrupt " + proc); corruptedCount++; } if (abortOnCorruption && corruptedCount > 0) { throw new IOException("found " + corruptedCount + " corrupted procedure(s) on replay"); } } }); }
public static void storeRestart(ProcedureStore procStore, ProcedureStore.ProcedureLoader loader) throws Exception { procStore.stop(false); procStore.start(procStore.getNumThreads()); procStore.recoverLease(); procStore.load(loader); }
private void load(final boolean abortOnCorruption) throws IOException { Preconditions.checkArgument(completed.isEmpty(), "completed not empty"); Preconditions.checkArgument(rollbackStack.isEmpty(), "rollback state not empty"); Preconditions.checkArgument(procedures.isEmpty(), "procedure map not empty"); Preconditions.checkArgument(scheduler.size() == 0, "run queue not empty"); store.load(new ProcedureStore.ProcedureLoader() { @Override public void setMaxProcId(long maxProcId) { assert lastProcId.get() < 0 : "expected only one call to setMaxProcId()"; lastProcId.set(maxProcId); } @Override public void load(ProcedureIterator procIter) throws IOException { loadProcedures(procIter, abortOnCorruption); } @Override public void handleCorrupted(ProcedureIterator procIter) throws IOException { int corruptedCount = 0; while (procIter.hasNext()) { Procedure<?> proc = procIter.next(); LOG.error("Corrupt " + proc); corruptedCount++; } if (abortOnCorruption && corruptedCount > 0) { throw new IOException("found " + corruptedCount + " corrupted procedure(s) on replay"); } } }); }
private void load(final boolean abortOnCorruption) throws IOException { Preconditions.checkArgument(completed.isEmpty(), "completed not empty"); Preconditions.checkArgument(rollbackStack.isEmpty(), "rollback state not empty"); Preconditions.checkArgument(procedures.isEmpty(), "procedure map not empty"); Preconditions.checkArgument(scheduler.size() == 0, "run queue not empty"); store.load(new ProcedureStore.ProcedureLoader() { @Override public void setMaxProcId(long maxProcId) { assert lastProcId.get() < 0 : "expected only one call to setMaxProcId()"; lastProcId.set(maxProcId); } @Override public void load(ProcedureIterator procIter) throws IOException { loadProcedures(procIter, abortOnCorruption); } @Override public void handleCorrupted(ProcedureIterator procIter) throws IOException { int corruptedCount = 0; while (procIter.hasNext()) { Procedure<?> proc = procIter.next(); LOG.error("Corrupt " + proc); corruptedCount++; } if (abortOnCorruption && corruptedCount > 0) { throw new IOException("found " + corruptedCount + " corrupted procedure(s) on replay"); } } }); }
Preconditions.checkArgument(runnables.size() == 0); store.load(new ProcedureStore.ProcedureLoader() { @Override public void setMaxProcId(long maxProcId) {
public static void storeRestart(ProcedureStore procStore, ProcedureStore.ProcedureLoader loader) throws Exception { procStore.stop(false); procStore.start(procStore.getNumThreads()); procStore.recoverLease(); procStore.load(loader); }
public static void storeRestart(ProcedureStore procStore, ProcedureStore.ProcedureLoader loader) throws Exception { procStore.stop(false); procStore.start(procStore.getNumThreads()); procStore.recoverLease(); procStore.load(loader); }