public void dump() { System.out.println("map " + map.size()); System.out.println("isUpdated " + isUpdated()); System.out.println("isEmpty " + isEmpty()); for (Map.Entry<Long, BitSetNode> entry : map.entrySet()) { entry.getValue().dump(); } }
public void dump() { System.out.println("map " + map.size()); System.out.println("isUpdated " + isUpdated()); System.out.println("isEmpty " + isEmpty()); for (Map.Entry<Long, BitSetNode> entry : map.entrySet()) { entry.getValue().dump(); } }
private void periodicRoll() throws IOException { if (storeTracker.isEmpty()) { if (LOG.isTraceEnabled()) { LOG.trace("no active procedures"); } tryRollWriter(); removeAllLogs(flushLogId - 1); } else { if (storeTracker.isUpdated()) { if (LOG.isTraceEnabled()) { LOG.trace("all the active procedures are in the latest log"); } removeAllLogs(flushLogId - 1); } // if the log size has exceeded the roll threshold // or the periodic roll timeout is expired, try to roll the wal. if (totalSynced.get() > rollThreshold || getMillisToNextPeriodicRoll() <= 0) { tryRollWriter(); } removeInactiveLogs(); } }
private static void assertUpdated(final ProcedureStoreTracker tracker, final Procedure[] procs, final int[] updatedProcs, final int[] nonUpdatedProcs) { for (int index : updatedProcs) { long procId = procs[index].getProcId(); assertTrue("Procedure id : " + procId, tracker.isUpdated(procId)); } for (int index : nonUpdatedProcs) { long procId = procs[index].getProcId(); assertFalse("Procedure id : " + procId, tracker.isUpdated(procId)); } }
private void periodicRoll() throws IOException { if (storeTracker.isEmpty()) { if (LOG.isTraceEnabled()) { LOG.trace("no active procedures"); } tryRollWriter(); removeAllLogs(flushLogId - 1); } else { if (storeTracker.isUpdated()) { if (LOG.isTraceEnabled()) { LOG.trace("all the active procedures are in the latest log"); } removeAllLogs(flushLogId - 1); } // if the log size has exceeded the roll threshold // or the periodic roll timeout is expired, try to roll the wal. if (totalSynced.get() > rollThreshold || getMillisToNextPeriodicRoll() <= 0) { tryRollWriter(); } removeInactiveLogs(); } }
@Test public void testBasicCRUD() { ProcedureStoreTracker tracker = new ProcedureStoreTracker(); assertTrue(tracker.isEmpty()); long[] procs = new long[] { 1, 2, 3, 4, 5, 6 }; tracker.insert(procs[0]); tracker.insert(procs[1], new long[] { procs[2], procs[3], procs[4] }); assertFalse(tracker.isEmpty()); assertTrue(tracker.isUpdated()); tracker.resetUpdates(); assertFalse(tracker.isUpdated()); for (int i = 0; i < 4; ++i) { tracker.update(procs[i]); assertFalse(tracker.isEmpty()); assertFalse(tracker.isUpdated()); } tracker.update(procs[4]); assertFalse(tracker.isEmpty()); assertTrue(tracker.isUpdated()); tracker.update(procs[5]); assertFalse(tracker.isEmpty()); assertTrue(tracker.isUpdated()); for (int i = 0; i < 5; ++i) { tracker.delete(procs[i]); assertFalse(tracker.isEmpty()); assertTrue(tracker.isUpdated()); } tracker.delete(procs[5]); assertTrue(tracker.isEmpty()); }