use of org.apache.cassandra.io.sstable.metadata.MetadataCollector in project cassandra by apache.
the class CompactionManager method createWriterForAntiCompaction.
public static SSTableWriter createWriterForAntiCompaction(ColumnFamilyStore cfs, File compactionFileLocation, int expectedBloomFilterSize, long repairedAt, UUID pendingRepair, Collection<SSTableReader> sstables, LifecycleTransaction txn) {
FileUtils.createDirectory(compactionFileLocation);
int minLevel = Integer.MAX_VALUE;
// after first migration to be able to drop the sstables back in their original place in the repaired sstable manifest
for (SSTableReader sstable : sstables) {
if (minLevel == Integer.MAX_VALUE)
minLevel = sstable.getSSTableLevel();
if (minLevel != sstable.getSSTableLevel()) {
minLevel = 0;
break;
}
}
return SSTableWriter.create(cfs.newSSTableDescriptor(compactionFileLocation), (long) expectedBloomFilterSize, repairedAt, pendingRepair, cfs.metadata, new MetadataCollector(sstables, cfs.metadata().comparator, minLevel), SerializationHeader.make(cfs.metadata(), sstables), cfs.indexManager.listIndexes(), txn);
}
use of org.apache.cassandra.io.sstable.metadata.MetadataCollector in project cassandra by apache.
the class Upgrader method createCompactionWriter.
private SSTableWriter createCompactionWriter(long repairedAt, UUID parentRepair) {
MetadataCollector sstableMetadataCollector = new MetadataCollector(cfs.getComparator());
sstableMetadataCollector.sstableLevel(sstable.getSSTableLevel());
return SSTableWriter.create(cfs.newSSTableDescriptor(directory), estimatedRows, repairedAt, parentRepair, cfs.metadata, sstableMetadataCollector, SerializationHeader.make(cfs.metadata(), Sets.newHashSet(sstable)), cfs.indexManager.listIndexes(), transaction);
}
use of org.apache.cassandra.io.sstable.metadata.MetadataCollector in project cassandra by apache.
the class DefaultCompactionWriter method switchCompactionLocation.
@Override
public void switchCompactionLocation(Directories.DataDirectory directory) {
@SuppressWarnings("resource") SSTableWriter writer = SSTableWriter.create(cfs.newSSTableDescriptor(getDirectories().getLocationForDisk(directory)), estimatedTotalKeys, minRepairedAt, pendingRepair, cfs.metadata, new MetadataCollector(txn.originals(), cfs.metadata().comparator, sstableLevel), SerializationHeader.make(cfs.metadata(), nonExpiredSSTables), cfs.indexManager.listIndexes(), txn);
sstableWriter.switchWriter(writer);
}
use of org.apache.cassandra.io.sstable.metadata.MetadataCollector in project cassandra by apache.
the class SplittingSizeTieredCompactionWriter method switchCompactionLocation.
@Override
public void switchCompactionLocation(Directories.DataDirectory location) {
this.location = location;
long currentPartitionsToWrite = Math.round(ratios[currentRatioIndex] * estimatedTotalKeys);
@SuppressWarnings("resource") SSTableWriter writer = SSTableWriter.create(cfs.newSSTableDescriptor(getDirectories().getLocationForDisk(location)), currentPartitionsToWrite, minRepairedAt, pendingRepair, cfs.metadata, new MetadataCollector(allSSTables, cfs.metadata().comparator, 0), SerializationHeader.make(cfs.metadata(), nonExpiredSSTables), cfs.indexManager.listIndexes(), txn);
logger.trace("Switching writer, currentPartitionsToWrite = {}", currentPartitionsToWrite);
sstableWriter.switchWriter(writer);
}
use of org.apache.cassandra.io.sstable.metadata.MetadataCollector in project cassandra by apache.
the class SSTableTxnWriter method create.
// log and writer closed during doPostCleanup
@SuppressWarnings("resource")
public static SSTableTxnWriter create(TableMetadataRef metadata, Descriptor descriptor, long keyCount, long repairedAt, UUID pendingRepair, int sstableLevel, SerializationHeader header, Collection<Index> indexes) {
// if the column family store does not exist, we create a new default SSTableMultiWriter to use:
LifecycleTransaction txn = LifecycleTransaction.offline(OperationType.WRITE);
MetadataCollector collector = new MetadataCollector(metadata.get().comparator).sstableLevel(sstableLevel);
SSTableMultiWriter writer = SimpleSSTableMultiWriter.create(descriptor, keyCount, repairedAt, pendingRepair, metadata, collector, header, indexes, txn);
return new SSTableTxnWriter(txn, writer);
}
Aggregations