public CommitLogPosition clone() { return new CommitLogPosition(segmentId, position); }
public boolean mayContainDataBefore(CommitLogPosition position) { return approximateCommitLogLowerBound.compareTo(position) < 0; }
public CommitLogPosition clone() { return new CommitLogPosition(segmentId, position); }
public int compareTo(Memtable that) { return this.approximateCommitLogLowerBound.compareTo(that.approximateCommitLogLowerBound); }
public CommitLogPosition clone() { return new CommitLogPosition(segmentId, position); }
public int compareTo(Memtable that) { return this.approximateCommitLogLowerBound.compareTo(that.approximateCommitLogLowerBound); }
public CommitLogPosition clone() { return new CommitLogPosition(segmentId, position); }
public boolean mayContainDataBefore(CommitLogPosition position) { return approximateCommitLogLowerBound.compareTo(position) < 0; }
/** * @return the current CommitLogPosition for this log segment */ public CommitLogPosition getCurrentCommitLogPosition() { return new CommitLogPosition(id, allocatePosition.get()); }
public boolean mayContainDataBefore(CommitLogPosition position) { return approximateCommitLogLowerBound.compareTo(position) < 0; }
public CommitLogPosition getCommitLogPosition() { return new CommitLogPosition(segment.id, buffer.limit()); } }
public int compareTo(Memtable that) { return this.approximateCommitLogLowerBound.compareTo(that.approximateCommitLogLowerBound); }
public CommitLogPosition getCommitLogPosition() { return new CommitLogPosition(segment.id, buffer.limit()); } }
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; } }
/** * @return the current CommitLogPosition for this log segment */ public CommitLogPosition getCurrentCommitLogPosition() { return new CommitLogPosition(id, allocatePosition.get()); }
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; } }
/** * @return the current CommitLogPosition for this log segment */ public CommitLogPosition getCurrentCommitLogPosition() { return new CommitLogPosition(id, allocatePosition.get()); }
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 CommitLogPosition getCommitLogPosition() { return new CommitLogPosition(segment.id, buffer.limit()); } }
private static void setCommitLogUpperBound(AtomicReference<CommitLogPosition> commitLogUpperBound) { // we attempt to set the holder to the current commit log context. at the same time all writes to the memtables are // also maintaining this value, so if somebody sneaks ahead of us somehow (should be rare) we simply retry, // so that we know all operations prior to the position have not reached it yet CommitLogPosition lastReplayPosition; while (true) { lastReplayPosition = new Memtable.LastCommitLogPosition((CommitLog.instance.getCurrentPosition())); CommitLogPosition currentLast = commitLogUpperBound.get(); if ((currentLast == null || currentLast.compareTo(lastReplayPosition) <= 0) && commitLogUpperBound.compareAndSet(currentLast, lastReplayPosition)) break; } }