Search in sources :

Example 31 with SSTableReader

use of org.apache.cassandra.io.sstable.SSTableReader in project eiger by wlloyd.

the class StreamOut method createPendingFiles.

// called prior to sending anything.
private static List<PendingFile> createPendingFiles(Iterable<SSTableReader> sstables, Collection<Range<Token>> ranges, OperationType type) {
    List<PendingFile> pending = new ArrayList<PendingFile>();
    for (SSTableReader sstable : sstables) {
        Descriptor desc = sstable.descriptor;
        List<Pair<Long, Long>> sections = sstable.getPositionsForRanges(ranges);
        if (sections.isEmpty()) {
            // A reference was acquired on the sstable and we won't stream it
            sstable.releaseReference();
            continue;
        }
        pending.add(new PendingFile(sstable, desc, SSTable.COMPONENT_DATA, sections, type, sstable.estimatedKeysForRanges(ranges)));
    }
    logger.info("Stream context metadata {}, {} sstables.", pending, Iterables.size(sstables));
    return pending;
}
Also used : SSTableReader(org.apache.cassandra.io.sstable.SSTableReader) Descriptor(org.apache.cassandra.io.sstable.Descriptor) Pair(org.apache.cassandra.utils.Pair)

Example 32 with SSTableReader

use of org.apache.cassandra.io.sstable.SSTableReader in project eiger by wlloyd.

the class DataTracker method getRecentBloomFilterFalseRatio.

public double getRecentBloomFilterFalseRatio() {
    long falseCount = 0L;
    long trueCount = 0L;
    for (SSTableReader sstable : getSSTables()) {
        falseCount += sstable.getRecentBloomFilterFalsePositiveCount();
        trueCount += sstable.getRecentBloomFilterTruePositiveCount();
    }
    if (falseCount == 0L && trueCount == 0L)
        return 0d;
    return (double) falseCount / (trueCount + falseCount);
}
Also used : SSTableReader(org.apache.cassandra.io.sstable.SSTableReader)

Example 33 with SSTableReader

use of org.apache.cassandra.io.sstable.SSTableReader in project eiger by wlloyd.

the class DataTracker method getMeanRowSize.

public long getMeanRowSize() {
    long sum = 0;
    long count = 0;
    for (SSTableReader sstable : getSSTables()) {
        sum += sstable.getEstimatedRowSize().mean();
        count++;
    }
    return count > 0 ? sum / count : 0;
}
Also used : SSTableReader(org.apache.cassandra.io.sstable.SSTableReader)

Example 34 with SSTableReader

use of org.apache.cassandra.io.sstable.SSTableReader in project eiger by wlloyd.

the class DataTracker method getMeanColumns.

public int getMeanColumns() {
    long sum = 0;
    int count = 0;
    for (SSTableReader sstable : getSSTables()) {
        sum += sstable.getEstimatedColumnCount().mean();
        count++;
    }
    return count > 0 ? (int) (sum / count) : 0;
}
Also used : SSTableReader(org.apache.cassandra.io.sstable.SSTableReader)

Example 35 with SSTableReader

use of org.apache.cassandra.io.sstable.SSTableReader in project eiger by wlloyd.

the class DataTracker method unmarkCompacting.

/**
 * Removes files from compacting status: this is different from 'markCompacted'
 * because it should be run regardless of whether a compaction succeeded.
 */
public void unmarkCompacting(Collection<SSTableReader> unmark) {
    if (!cfstore.isValid()) {
        // is harmlessly redundant, and if it failed ensures that at least the sstable will get deleted on restart.
        for (SSTableReader sstable : unmark) sstable.markCompacted();
    }
    View currentView, newView;
    do {
        currentView = view.get();
        newView = currentView.unmarkCompacting(unmark);
    } while (!view.compareAndSet(currentView, newView));
}
Also used : SSTableReader(org.apache.cassandra.io.sstable.SSTableReader)

Aggregations

SSTableReader (org.apache.cassandra.io.sstable.SSTableReader)45 Test (org.junit.Test)16 File (java.io.File)14 ColumnFamily (org.apache.cassandra.db.ColumnFamily)10 QueryPath (org.apache.cassandra.db.filter.QueryPath)10 SSTableUtils.tempSSTableFile (org.apache.cassandra.io.sstable.SSTableUtils.tempSSTableFile)9 IOException (java.io.IOException)8 QueryFilter (org.apache.cassandra.db.filter.QueryFilter)7 SSTableWriter (org.apache.cassandra.io.sstable.SSTableWriter)7 IColumnIterator (org.apache.cassandra.db.columniterator.IColumnIterator)6 PrintStream (java.io.PrintStream)5 FileReader (java.io.FileReader)4 ColumnFamilyStore (org.apache.cassandra.db.ColumnFamilyStore)4 ExpiringColumn (org.apache.cassandra.db.ExpiringColumn)4 IColumn (org.apache.cassandra.db.IColumn)4 Token (org.apache.cassandra.dht.Token)4 JSONArray (org.json.simple.JSONArray)4 JSONObject (org.json.simple.JSONObject)4 ByteBuffer (java.nio.ByteBuffer)3 CounterColumn (org.apache.cassandra.db.CounterColumn)3