public MetadataCollector(Collection<SSTableReader> sstables, CellNameType columnNameComparator, int level) { this(columnNameComparator); replayPosition(ReplayPosition.getReplayPosition(sstables)); sstableLevel(level); // Get the max timestamp of the precompacted sstables // and adds generation of live ancestors for (SSTableReader sstable : sstables) { addAncestor(sstable.descriptor.generation); for (Integer i : sstable.getAncestors()) if (new File(sstable.descriptor.withGeneration(i).filenameFor(Component.DATA)).exists()) addAncestor(i); } }
private SSTableWriter createCompactionWriter(long repairedAt) { MetadataCollector sstableMetadataCollector = new MetadataCollector(cfs.getComparator()); // Get the max timestamp of the precompacted sstables // and adds generation of live ancestors sstableMetadataCollector.addAncestor(sstable.descriptor.generation); for (Integer i : sstable.getAncestors()) { if (new File(sstable.descriptor.withGeneration(i).filenameFor(Component.DATA)).exists()) sstableMetadataCollector.addAncestor(i); } sstableMetadataCollector.sstableLevel(sstable.getSSTableLevel()); return new SSTableWriter(cfs.getTempSSTablePath(directory), estimatedRows, repairedAt, cfs.metadata, cfs.partitioner, sstableMetadataCollector); }