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; } }
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; } }
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; } }
initialMemtable = new Memtable(new AtomicReference<>(CommitLog.instance.getCurrentPosition()), this); data = new Tracker(initialMemtable, loadSSTables);
initialMemtable = new Memtable(new AtomicReference<>(CommitLog.instance.getCurrentPosition()), this); data = new Tracker(initialMemtable, loadSSTables);
initialMemtable = new Memtable(new AtomicReference<>(CommitLog.instance.getCurrentPosition()), this); data = new Tracker(initialMemtable, loadSSTables);