Search in sources :

Example 1 with LifecycleNewTracker

use of org.apache.cassandra.db.lifecycle.LifecycleNewTracker in project cassandra by apache.

the class CassandraEntireSSTableStreamReader method createWriter.

@SuppressWarnings("resource")
protected BigTableZeroCopyWriter createWriter(ColumnFamilyStore cfs, long totalSize, Collection<Component> components) throws IOException {
    File dataDir = getDataDir(cfs, totalSize);
    StreamReceiver streamReceiver = session.getAggregator(tableId);
    assert streamReceiver instanceof CassandraStreamReceiver;
    LifecycleNewTracker lifecycleNewTracker = CassandraStreamReceiver.fromReceiver(session.getAggregator(tableId)).createLifecycleNewTracker();
    Descriptor desc = cfs.newSSTableDescriptor(dataDir, header.version, header.format);
    logger.debug("[Table #{}] {} Components to write: {}", cfs.metadata(), desc.filenameFor(Component.DATA), components);
    return new BigTableZeroCopyWriter(desc, cfs.metadata, lifecycleNewTracker, components);
}
Also used : LifecycleNewTracker(org.apache.cassandra.db.lifecycle.LifecycleNewTracker) StreamReceiver(org.apache.cassandra.streaming.StreamReceiver) BigTableZeroCopyWriter(org.apache.cassandra.io.sstable.format.big.BigTableZeroCopyWriter) Descriptor(org.apache.cassandra.io.sstable.Descriptor) File(org.apache.cassandra.io.util.File)

Example 2 with LifecycleNewTracker

use of org.apache.cassandra.db.lifecycle.LifecycleNewTracker in project cassandra by apache.

the class CassandraStreamReader method createWriter.

@SuppressWarnings("resource")
protected SSTableMultiWriter createWriter(ColumnFamilyStore cfs, long totalSize, long repairedAt, UUID pendingRepair, SSTableFormat.Type format) throws IOException {
    Directories.DataDirectory localDir = cfs.getDirectories().getWriteableLocation(totalSize);
    if (localDir == null)
        throw new IOException(String.format("Insufficient disk space to store %s", FBUtilities.prettyPrintMemory(totalSize)));
    StreamReceiver streamReceiver = session.getAggregator(tableId);
    Preconditions.checkState(streamReceiver instanceof CassandraStreamReceiver);
    LifecycleNewTracker lifecycleNewTracker = CassandraStreamReceiver.fromReceiver(session.getAggregator(tableId)).createLifecycleNewTracker();
    RangeAwareSSTableWriter writer = new RangeAwareSSTableWriter(cfs, estimatedKeys, repairedAt, pendingRepair, false, format, sstableLevel, totalSize, lifecycleNewTracker, getHeader(cfs.metadata()));
    return writer;
}
Also used : Directories(org.apache.cassandra.db.Directories) RangeAwareSSTableWriter(org.apache.cassandra.io.sstable.format.RangeAwareSSTableWriter) LifecycleNewTracker(org.apache.cassandra.db.lifecycle.LifecycleNewTracker) StreamReceiver(org.apache.cassandra.streaming.StreamReceiver) IOException(java.io.IOException)

Aggregations

LifecycleNewTracker (org.apache.cassandra.db.lifecycle.LifecycleNewTracker)2 StreamReceiver (org.apache.cassandra.streaming.StreamReceiver)2 IOException (java.io.IOException)1 Directories (org.apache.cassandra.db.Directories)1 Descriptor (org.apache.cassandra.io.sstable.Descriptor)1 RangeAwareSSTableWriter (org.apache.cassandra.io.sstable.format.RangeAwareSSTableWriter)1 BigTableZeroCopyWriter (org.apache.cassandra.io.sstable.format.big.BigTableZeroCopyWriter)1 File (org.apache.cassandra.io.util.File)1