@Override public void abortProcess() { LOG.error(HBaseMarkers.FATAL, "Abort the Procedure Store"); store.stop(true); } };
@Override public void abortProcess() { LOG.debug("Abort store of backupMaster3"); backupStore3Abort.countDown(); backupStore3.stop(true); } });
/** * Parses a directory of WALs building up ProcedureState. * For testing parse and profiling. * @param args Include pointer to directory of WAL files for a store instance to parse & load. */ public static void main(String [] args) throws IOException { Configuration conf = HBaseConfiguration.create(); if (args == null || args.length != 1) { System.out.println("ERROR: Empty arguments list; pass path to MASTERPROCWALS_DIR."); System.out.println("Usage: WALProcedureStore MASTERPROCWALS_DIR"); System.exit(-1); } WALProcedureStore store = new WALProcedureStore(conf, new Path(args[0]), null, new WALProcedureStore.LeaseRecovery() { @Override public void recoverFileLease(FileSystem fs, Path path) throws IOException { // no-op } }); try { store.start(16); ProcedureExecutor<?> pe = new ProcedureExecutor<>(conf, new Object()/*Pass anything*/, store); pe.init(1, true); } finally { store.stop(true); } } }
private void stopStoreAndExecutor() { EXEC.stop(); STORE.stop(false); EXEC = null; STORE = null; }
@After public void tearDown() throws IOException { procStore.stop(false); fs.delete(logDir, true); }
@After public void tearDown() throws IOException { procStore.stop(false); fs.delete(logDir, true); }
public void tearDownProcedureStore() { store.stop(false); try { store.getFileSystem().delete(store.getWALDir(), true); } catch (IOException e) { System.err.println("Error: Couldn't delete log dir. You can delete it manually to free up " + "disk space. Location: " + store.getWALDir().toString()); System.err.println(e.toString()); } }
private void tearDownProcedureStore() { store.stop(false); try { store.getFileSystem().delete(store.getWALDir(), true); } catch (IOException e) { System.err.println("Error: Couldn't delete log dir. You can delete it manually to free up " + "disk space. Location: " + store.getWALDir().toString()); e.printStackTrace(); } }
@After public void tearDown() { procExec.stop(); procStore.stop(false); }
@After public void tearDown() { procExec.stop(); procStore.stop(false); }
private void storeRestart(ProcedureStore.ProcedureLoader loader) throws IOException { System.out.println("Restarting procedure store to read back the WALs"); store.stop(false); store.start(1); store.recoverLease(); long startTime = currentTimeMillis(); store.load(loader); long timeTaken = System.currentTimeMillis() - startTime; System.out.println("******************************************"); System.out.println("Load time : " + (timeTaken / 1000.0f) + "sec"); System.out.println("******************************************"); System.out.println("Raw format for scripts"); System.out.println(String.format("RESULT [%s=%s, %s=%s, %s=%s, %s=%s, %s=%s, " + "total_time_ms=%s]", NUM_PROCS_OPTION.getOpt(), numProcs, STATE_SIZE_OPTION.getOpt(), serializedState.length, UPDATES_PER_PROC_OPTION.getOpt(), updatesPerProc, DELETE_PROCS_FRACTION_OPTION.getOpt(), deleteProcsFraction, NUM_WALS_OPTION.getOpt(), numWals, timeTaken)); }
private void stopProcedureExecutor() { if (procedureExecutor != null) { configurationManager.deregisterObserver(procedureExecutor.getEnvironment()); procedureExecutor.getEnvironment().getRemoteDispatcher().stop(); procedureExecutor.stop(); procedureExecutor.join(); procedureExecutor = null; } if (procedureStore != null) { procedureStore.stop(isAborted()); procedureStore = null; } }
@SuppressWarnings("JUnit4TearDownNotRun") public void tearDown() throws Exception { store.stop(false); UTIL.getDFSCluster().getFileSystem().delete(store.getWALDir(), true); try { UTIL.shutdownMiniCluster(); } catch (Exception e) { LOG.warn("failure shutting down cluster", e); } }
procStore.stop(false); FileStatus[] logs = fs.listStatus(logDir); assertEquals(3, logs.length);
@Test public void testCorruptedTrailer() throws Exception { // Insert something for (int i = 0; i < 100; ++i) { procStore.insert(new TestSequentialProcedure(), null); } // Stop the store procStore.stop(false); // Remove 4 byte from the trailer FileStatus[] logs = fs.listStatus(logDir); assertEquals(1, logs.length); corruptLog(logs[0], 4); LoadCounter loader = new LoadCounter(); storeRestart(loader); assertEquals(100, loader.getLoadedCount()); assertEquals(0, loader.getCorruptedCount()); }
@Test public void testCorruptedEntries() throws Exception { // Insert something for (int i = 0; i < 100; ++i) { procStore.insert(new TestSequentialProcedure(), null); } // Stop the store procStore.stop(false); // Remove some byte from the log // (enough to cut the trailer and corrupt some entries) FileStatus[] logs = fs.listStatus(logDir); assertEquals(1, logs.length); corruptLog(logs[0], 1823); LoadCounter loader = new LoadCounter(); storeRestart(loader); assertTrue(procStore.getCorruptedLogs() != null); assertEquals(1, procStore.getCorruptedLogs().size()); assertEquals(87, loader.getLoadedCount()); assertEquals(0, loader.getCorruptedCount()); }
procStore.stop(false);
procStore.stop(false); FileStatus[] logs = fs.listStatus(logDir); assertEquals(4, logs.length);
procStore.rollWriterForTesting(); procStore.stop(false);
FAIL_LOAD = true; UTIL.getMiniHBaseCluster().getMaster().getWalProcedureStore().stop(true); UTIL.getMiniHBaseCluster().getMaster().abort("for testing"); waitNoMaster();