use of org.apache.cassandra.io.sstable.SSTableReader in project eiger by wlloyd.
the class DataTracker method addNewSSTablesSize.
private void addNewSSTablesSize(Iterable<SSTableReader> newSSTables) {
for (SSTableReader sstable : newSSTables) {
assert sstable.getKeySamples() != null;
if (logger.isDebugEnabled())
logger.debug(String.format("adding %s to list of files tracked for %s.%s", sstable.descriptor, cfstore.table.name, cfstore.getColumnFamilyName()));
long size = sstable.bytesOnDisk();
liveSize.addAndGet(size);
totalSize.addAndGet(size);
sstable.setTrackedBy(this);
}
}
use of org.apache.cassandra.io.sstable.SSTableReader in project eiger by wlloyd.
the class DataTracker method removeOldSSTablesSize.
private void removeOldSSTablesSize(Iterable<SSTableReader> oldSSTables) {
for (SSTableReader sstable : oldSSTables) {
if (logger.isDebugEnabled())
logger.debug(String.format("removing %s from list of files tracked for %s.%s", sstable.descriptor, cfstore.table.name, cfstore.getColumnFamilyName()));
liveSize.addAndGet(-sstable.bytesOnDisk());
boolean firstToCompact = sstable.markCompacted();
assert firstToCompact : sstable + " was already marked compacted";
sstable.releaseReference();
}
}
use of org.apache.cassandra.io.sstable.SSTableReader in project eiger by wlloyd.
the class DataTracker method getCompressionRatio.
public double getCompressionRatio() {
double sum = 0;
int total = 0;
for (SSTableReader sstable : getSSTables()) {
if (sstable.getCompressionRatio() != Double.MIN_VALUE) {
sum += sstable.getCompressionRatio();
total++;
}
}
return total != 0 ? (double) sum / total : 0;
}
use of org.apache.cassandra.io.sstable.SSTableReader in project eiger by wlloyd.
the class DataTracker method addSSTables.
public void addSSTables(Collection<SSTableReader> sstables) {
replace(Collections.<SSTableReader>emptyList(), sstables);
for (SSTableReader sstable : sstables) {
incrementallyBackup(sstable);
notifyAdded(sstable);
}
}
use of org.apache.cassandra.io.sstable.SSTableReader in project eiger by wlloyd.
the class CollationController method collectAllData.
/**
* Collects data the brute-force way: gets an iterator for the filter in question
* from every memtable and sstable, then merges them together.
*/
private ColumnFamily collectAllData() {
logger.debug("collectAllData");
ISortedColumns.Factory factory = mutableColumns ? AtomicSortedColumns.factory() : ArrayBackedSortedColumns.factory();
List<IColumnIterator> iterators = new ArrayList<IColumnIterator>();
ColumnFamily returnCF = ColumnFamily.create(cfs.metadata, factory, filter.filter.isReversed());
ColumnFamilyStore.ViewFragment view = cfs.markReferenced(filter.key);
try {
for (Memtable memtable : view.memtables) {
IColumnIterator iter = filter.getMemtableColumnIterator(memtable);
if (iter != null) {
returnCF.delete(iter.getColumnFamily());
iterators.add(iter);
}
}
for (SSTableReader sstable : view.sstables) {
IColumnIterator iter = filter.getSSTableColumnIterator(sstable);
iterators.add(iter);
if (iter.getColumnFamily() != null) {
returnCF.delete(iter.getColumnFamily());
sstablesIterated++;
}
}
// and "there used to be data, but it's gone now" (we should cache the empty CF so we don't need to rebuild that slower)
if (iterators.isEmpty())
return null;
filter.collateColumns(returnCF, iterators, gcBefore);
// Caller is responsible for final removeDeletedCF. This is important for cacheRow to work correctly:
return returnCF;
} finally {
for (IColumnIterator iter : iterators) FileUtils.closeQuietly(iter);
SSTableReader.releaseReferences(view.sstables);
}
}
Aggregations