/** * update a reader: if !original, this is a reader that is being introduced by this transaction; * otherwise it must be in the originals() set, i.e. a reader guarded by this transaction */ public void update(SSTableReader reader, boolean original) { assert !staged.update.contains(reader) : "each reader may only be updated once per checkpoint: " + reader; assert !identities.contains(reader.instanceId) : "each reader instance may only be provided as an update once: " + reader; // check it isn't obsolete, and that it matches the original flag assert !(logged.obsolete.contains(reader) || staged.obsolete.contains(reader)) : "may not update a reader that has been obsoleted"; assert original == originals.contains(reader) : String.format("the 'original' indicator was incorrect (%s provided): %s", original, reader); staged.update.add(reader); identities.add(reader.instanceId); if (!isOffline()) reader.setupOnline(); }
/** * update a reader: if !original, this is a reader that is being introduced by this transaction; * otherwise it must be in the originals() set, i.e. a reader guarded by this transaction */ public void update(SSTableReader reader, boolean original) { assert !staged.update.contains(reader) : "each reader may only be updated once per checkpoint: " + reader; assert !identities.contains(reader.instanceId) : "each reader instance may only be provided as an update once: " + reader; // check it isn't obsolete, and that it matches the original flag assert !(logged.obsolete.contains(reader) || staged.obsolete.contains(reader)) : "may not update a reader that has been obsoleted"; assert original == originals.contains(reader) : String.format("the 'original' indicator was incorrect (%s provided): %s", original, reader); staged.update.add(reader); identities.add(reader.instanceId); if (!isOffline()) reader.setupOnline(); }
/** * update a reader: if !original, this is a reader that is being introduced by this transaction; * otherwise it must be in the originals() set, i.e. a reader guarded by this transaction */ public void update(SSTableReader reader, boolean original) { assert !staged.update.contains(reader) : "each reader may only be updated once per checkpoint: " + reader; assert !identities.contains(reader.instanceId) : "each reader instance may only be provided as an update once: " + reader; // check it isn't obsolete, and that it matches the original flag assert !(logged.obsolete.contains(reader) || staged.obsolete.contains(reader)) : "may not update a reader that has been obsoleted"; assert original == originals.contains(reader) : String.format("the 'original' indicator was incorrect (%s provided): %s", original, reader); staged.update.add(reader); identities.add(reader.instanceId); if (!isOffline()) reader.setupOnline(); }
public RowIndexEntry append(UnfilteredRowIterator partition) { // we do this before appending to ensure we can resetAndTruncate() safely if the append fails DecoratedKey key = partition.partitionKey(); maybeReopenEarly(key); RowIndexEntry index = writer.append(partition); if (!transaction.isOffline() && index != null) { for (SSTableReader reader : transaction.originals()) { if (reader.getCachedPosition(key, false) != null) { cachedKeys.put(key, index); break; } } } return index; }
public RowIndexEntry append(UnfilteredRowIterator partition) { // we do this before appending to ensure we can resetAndTruncate() safely if the append fails DecoratedKey key = partition.partitionKey(); maybeReopenEarly(key); RowIndexEntry index = writer.append(partition); if (!transaction.isOffline() && index != null) { for (SSTableReader reader : transaction.originals()) { if (reader.getCachedPosition(key, false) != null) { cachedKeys.put(key, index); break; } } } return index; }
public RowIndexEntry append(UnfilteredRowIterator partition) { // we do this before appending to ensure we can resetAndTruncate() safely if the append fails DecoratedKey key = partition.partitionKey(); maybeReopenEarly(key); RowIndexEntry index = writer.append(partition); if (!transaction.isOffline() && index != null) { for (SSTableReader reader : transaction.originals()) { if (reader.getCachedPosition(key, false) != null) { cachedKeys.put(key, index); break; } } } return index; }
if (transaction.isOffline()) return; if (preemptiveOpenInterval == Long.MAX_VALUE)
if (transaction.isOffline()) return; if (preemptiveOpenInterval == Long.MAX_VALUE)
if (transaction.isOffline()) return; if (preemptiveOpenInterval == Long.MAX_VALUE)
if (transaction.isOffline())
this.dataFile = transaction.isOffline() ? sstable.openDataReader() : sstable.openDataReader(CompactionManager.instance.getRateLimiter());
this.dataFile = transaction.isOffline() ? sstable.openDataReader() : sstable.openDataReader(CompactionManager.instance.getRateLimiter());
if (transaction.isOffline())
this.dataFile = transaction.isOffline() ? sstable.openDataReader() : sstable.openDataReader(CompactionManager.instance.getRateLimiter());
if (transaction.isOffline())
if (transaction.isOffline()) finished.forEach(sstable -> sstable.selfRef().release());
if (transaction.isOffline()) finished.forEach(sstable -> sstable.selfRef().release());
private void maybeReopenEarly(DecoratedKey key) { if (writer.getFilePointer() - currentlyOpenedEarlyAt > preemptiveOpenInterval) { if (transaction.isOffline()) { for (SSTableReader reader : transaction.originals()) { RowIndexEntry index = reader.getPosition(key, SSTableReader.Operator.GE); NativeLibrary.trySkipCache(reader.getFilename(), 0, index == null ? 0 : index.position); } } else { SSTableReader reader = writer.setMaxDataAge(maxAge).openEarly(); if (reader != null) { transaction.update(reader, false); currentlyOpenedEarlyAt = writer.getFilePointer(); moveStarts(reader, reader.last); transaction.checkpoint(); } } } }
private void maybeReopenEarly(DecoratedKey key) { if (writer.getFilePointer() - currentlyOpenedEarlyAt > preemptiveOpenInterval) { if (transaction.isOffline()) { for (SSTableReader reader : transaction.originals()) { RowIndexEntry index = reader.getPosition(key, SSTableReader.Operator.GE); NativeLibrary.trySkipCache(reader.getFilename(), 0, index == null ? 0 : index.position); } } else { SSTableReader reader = writer.setMaxDataAge(maxAge).openEarly(); if (reader != null) { transaction.update(reader, false); currentlyOpenedEarlyAt = writer.getFilePointer(); moveStarts(reader, reader.last); transaction.checkpoint(); } } } }
private void maybeReopenEarly(DecoratedKey key) { if (writer.getFilePointer() - currentlyOpenedEarlyAt > preemptiveOpenInterval) { if (transaction.isOffline()) { for (SSTableReader reader : transaction.originals()) { RowIndexEntry index = reader.getPosition(key, SSTableReader.Operator.GE); NativeLibrary.trySkipCache(reader.getFilename(), 0, index == null ? 0 : index.position); } } else { SSTableReader reader = writer.setMaxDataAge(maxAge).openEarly(); if (reader != null) { transaction.update(reader, false); currentlyOpenedEarlyAt = writer.getFilePointer(); moveStarts(reader, reader.last); transaction.checkpoint(); } } } }