Java Code Examples for org.apache.cassandra.io.sstable.SSTableReader#setTrackedBy()

The following examples show how to use org.apache.cassandra.io.sstable.SSTableReader#setTrackedBy() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataTracker.java    From stratio-cassandra with Apache License 2.0 6 votes vote down vote up
/**
 * A special kind of replacement for SSTableReaders that were cloned with a new index summary sampling level (see
 * SSTableReader.cloneWithNewSummarySamplingLevel and CASSANDRA-5519).  This does not mark the old reader
 * as compacted.
 * @param oldSSTables replaced readers
 * @param newSSTables replacement readers
 */
private void replaceReaders(Collection<SSTableReader> oldSSTables, Collection<SSTableReader> newSSTables, boolean notify)
{
    View currentView, newView;
    do
    {
        currentView = view.get();
        newView = currentView.replace(oldSSTables, newSSTables);
    }
    while (!view.compareAndSet(currentView, newView));

    if (!oldSSTables.isEmpty() && notify)
        notifySSTablesChanged(oldSSTables, newSSTables, OperationType.UNKNOWN);

    for (SSTableReader sstable : newSSTables)
        sstable.setTrackedBy(this);

    Refs.release(Refs.selfRefs(oldSSTables));
}
 
Example 2
Source File: DataTracker.java    From stratio-cassandra with Apache License 2.0 5 votes vote down vote up
private void addNewSSTablesSize(Iterable<SSTableReader> newSSTables)
{
    for (SSTableReader sstable : newSSTables)
    {
        if (logger.isDebugEnabled())
            logger.debug(String.format("adding %s to list of files tracked for %s.%s",
                        sstable.descriptor, cfstore.keyspace.getName(), cfstore.name));
        long size = sstable.bytesOnDisk();
        StorageMetrics.load.inc(size);
        cfstore.metric.liveDiskSpaceUsed.inc(size);
        cfstore.metric.totalDiskSpaceUsed.inc(size);
        sstable.setTrackedBy(this);
    }
}