@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()); }
long millisFromLastRoll = walStore.getMillisFromLastRoll(); ArrayList<ProcedureWALFile> procedureWALFiles = walStore.getActiveLogs(); Set<ProcedureWALFile> corruptedWALFiles = walStore.getCorruptedLogs(); List<Procedure<MasterProcedureEnv>> procedures = procExecutor.getProcedures(); Collections.sort(procedures, new Comparator<Procedure>() {
@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()); }
@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()); }