writeBarrier.issue(); postFlush = new PostFlush(!truncate, writeBarrier, lastReplayPosition);
public boolean accepts(OpOrder.Group opGroup, ReplayPosition replayPosition) { // if the barrier hasn't been set yet, then this memtable is still taking ALL writes OpOrder.Barrier barrier = this.writeBarrier; if (barrier == null) return true; // if the barrier has been set, but is in the past, we are definitely destined for a future memtable if (!barrier.isAfter(opGroup)) return false; // if we aren't durable we are directed only by the barrier if (replayPosition == null) return true; while (true) { // otherwise we check if we are in the past/future wrt the CL boundary; // if the boundary hasn't been finalised yet, we simply update it to the max of // its current value and ours; if it HAS been finalised, we simply accept its judgement // this permits us to coordinate a safe boundary, as the boundary choice is made // atomically wrt our max() maintenance, so an operation cannot sneak into the past ReplayPosition currentLast = lastReplayPosition.get(); if (currentLast instanceof LastReplayPosition) return currentLast.compareTo(replayPosition) >= 0; if (currentLast != null && currentLast.compareTo(replayPosition) >= 0) return true; if (lastReplayPosition.compareAndSet(currentLast, replayPosition)) return true; } }
writeBarrier.markBlocking(); writeBarrier.await();
barrier.issue();
writeBarrier.issue(); postFlush = new PostFlush(memtables); postFlushTask = ListenableFutureTask.create(postFlush);
writeBarrier.issue(); postFlush = new PostFlush(memtables); postFlushTask = ListenableFutureTask.create(postFlush);
public void run() writeBarrier.await();
writeBarrier.issue(); postFlush = new PostFlush(memtables); postFlushTask = ListenableFutureTask.create(postFlush);
public boolean accepts(OpOrder.Group opGroup, CommitLogPosition commitLogPosition) { // if the barrier hasn't been set yet, then this memtable is still taking ALL writes OpOrder.Barrier barrier = this.writeBarrier; if (barrier == null) return true; // if the barrier has been set, but is in the past, we are definitely destined for a future memtable if (!barrier.isAfter(opGroup)) return false; // if we aren't durable we are directed only by the barrier if (commitLogPosition == null) return true; while (true) { // otherwise we check if we are in the past/future wrt the CL boundary; // if the boundary hasn't been finalised yet, we simply update it to the max of // its current value and ours; if it HAS been finalised, we simply accept its judgement // this permits us to coordinate a safe boundary, as the boundary choice is made // atomically wrt our max() maintenance, so an operation cannot sneak into the past CommitLogPosition currentLast = commitLogUpperBound.get(); if (currentLast instanceof LastCommitLogPosition) return currentLast.compareTo(commitLogPosition) >= 0; if (currentLast != null && currentLast.compareTo(commitLogPosition) >= 0) return true; if (commitLogUpperBound.compareAndSet(currentLast, commitLogPosition)) return true; } }
public boolean accepts(OpOrder.Group opGroup, CommitLogPosition commitLogPosition) { // if the barrier hasn't been set yet, then this memtable is still taking ALL writes OpOrder.Barrier barrier = this.writeBarrier; if (barrier == null) return true; // if the barrier has been set, but is in the past, we are definitely destined for a future memtable if (!barrier.isAfter(opGroup)) return false; // if we aren't durable we are directed only by the barrier if (commitLogPosition == null) return true; while (true) { // otherwise we check if we are in the past/future wrt the CL boundary; // if the boundary hasn't been finalised yet, we simply update it to the max of // its current value and ours; if it HAS been finalised, we simply accept its judgement // this permits us to coordinate a safe boundary, as the boundary choice is made // atomically wrt our max() maintenance, so an operation cannot sneak into the past CommitLogPosition currentLast = commitLogUpperBound.get(); if (currentLast instanceof LastCommitLogPosition) return currentLast.compareTo(commitLogPosition) >= 0; if (currentLast != null && currentLast.compareTo(commitLogPosition) >= 0) return true; if (commitLogUpperBound.compareAndSet(currentLast, commitLogPosition)) return true; } }
public void run() { // mark writes older than the barrier as blocking progress, permitting them to exceed our memory limit // if they are stuck waiting on it, then wait for them all to complete writeBarrier.markBlocking(); writeBarrier.await(); // mark all memtables as flushing, removing them from the live memtable list for (Memtable memtable : memtables) memtable.cfs.data.markFlushing(memtable); metric.memtableSwitchCount.inc(); try { // Flush "data" memtable with non-cf 2i first; flushMemtable(memtables.get(0), true); for (int i = 1; i < memtables.size(); i++) flushMemtable(memtables.get(i), false); } catch (Throwable t) { JVMStabilityInspector.inspectThrowable(t); postFlush.flushFailure = t; } // signal the post-flush we've done our work postFlush.latch.countDown(); }
public boolean accepts(OpOrder.Group opGroup, CommitLogPosition commitLogPosition) { // if the barrier hasn't been set yet, then this memtable is still taking ALL writes OpOrder.Barrier barrier = this.writeBarrier; if (barrier == null) return true; // if the barrier has been set, but is in the past, we are definitely destined for a future memtable if (!barrier.isAfter(opGroup)) return false; // if we aren't durable we are directed only by the barrier if (commitLogPosition == null) return true; while (true) { // otherwise we check if we are in the past/future wrt the CL boundary; // if the boundary hasn't been finalised yet, we simply update it to the max of // its current value and ours; if it HAS been finalised, we simply accept its judgement // this permits us to coordinate a safe boundary, as the boundary choice is made // atomically wrt our max() maintenance, so an operation cannot sneak into the past CommitLogPosition currentLast = commitLogUpperBound.get(); if (currentLast instanceof LastCommitLogPosition) return currentLast.compareTo(commitLogPosition) >= 0; if (currentLast != null && currentLast.compareTo(commitLogPosition) >= 0) return true; if (commitLogUpperBound.compareAndSet(currentLast, commitLogPosition)) return true; } }
public void run() { // mark writes older than the barrier as blocking progress, permitting them to exceed our memory limit // if they are stuck waiting on it, then wait for them all to complete writeBarrier.markBlocking(); writeBarrier.await(); // mark all memtables as flushing, removing them from the live memtable list for (Memtable memtable : memtables) memtable.cfs.data.markFlushing(memtable); metric.memtableSwitchCount.inc(); try { // Flush "data" memtable with non-cf 2i first; flushMemtable(memtables.get(0), true); for (int i = 1; i < memtables.size(); i++) flushMemtable(memtables.get(i), false); } catch (Throwable t) { JVMStabilityInspector.inspectThrowable(t); postFlush.flushFailure = t; } // signal the post-flush we've done our work postFlush.latch.countDown(); }
public void run() { if (logger.isTraceEnabled()) logger.trace("Async instance tidier for {}, before barrier", descriptor); if (barrier != null) barrier.await(); if (logger.isTraceEnabled()) logger.trace("Async instance tidier for {}, after barrier", descriptor); if (bf != null) bf.close(); if (summary != null) summary.close(); if (runOnClose != null) runOnClose.run(); if (dfile != null) dfile.close(); if (ifile != null) ifile.close(); globalRef.release(); if (logger.isTraceEnabled()) logger.trace("Async instance tidier for {}, completed", descriptor); } });
public void run() { if (logger.isTraceEnabled()) logger.trace("Async instance tidier for {}, before barrier", descriptor); if (barrier != null) barrier.await(); if (logger.isTraceEnabled()) logger.trace("Async instance tidier for {}, after barrier", descriptor); if (bf != null) bf.close(); if (summary != null) summary.close(); if (runOnClose != null) runOnClose.run(); if (dfile != null) dfile.close(); if (ifile != null) ifile.close(); globalRef.release(); if (logger.isTraceEnabled()) logger.trace("Async instance tidier for {}, completed", descriptor); } });
public void run() { if (logger.isTraceEnabled()) logger.trace("Async instance tidier for {}, before barrier", descriptor); if (barrier != null) barrier.await(); if (logger.isTraceEnabled()) logger.trace("Async instance tidier for {}, after barrier", descriptor); if (bf != null) bf.close(); if (summary != null) summary.close(); if (runOnClose != null) runOnClose.run(); if (dfile != null) dfile.close(); if (ifile != null) ifile.close(); globalRef.release(); if (logger.isTraceEnabled()) logger.trace("Async instance tidier for {}, completed", descriptor); } });