List of usage examples for org.apache.cassandra.db.lifecycle SSTableSet CANONICAL
SSTableSet CANONICAL
To view the source code for org.apache.cassandra.db.lifecycle SSTableSet CANONICAL.
Click Source Link
From source file:com.jeffjirsa.cassandra.db.compaction.TimeWindowCompactionStrategy.java
License:Apache License
/** * * @param gcBefore/*from ww w . ja va 2 s .c o m*/ * @return */ private List<SSTableReader> getNextBackgroundSSTables(final int gcBefore) { if (Iterables.isEmpty(cfs.getSSTables(SSTableSet.LIVE))) return Collections.emptyList(); Set<SSTableReader> uncompacting = ImmutableSet .copyOf(filter(cfs.getUncompactingSSTables(), sstables::contains)); // Find fully expired SSTables. Those will be included no matter what. Set<SSTableReader> expired = Collections.emptySet(); if (System.currentTimeMillis() - lastExpiredCheck > options.expiredSSTableCheckFrequency) { logger.debug("TWCS expired check sufficiently far in the past, checking for fully expired SSTables"); expired = CompactionController.getFullyExpiredSSTables(cfs, uncompacting, cfs.getOverlappingSSTables(SSTableSet.CANONICAL, uncompacting), gcBefore); lastExpiredCheck = System.currentTimeMillis(); } else { logger.debug("TWCS skipping check for fully expired SSTables"); } Set<SSTableReader> candidates = Sets.newHashSet(filterSuspectSSTables(uncompacting)); List<SSTableReader> compactionCandidates = new ArrayList<>( getNextNonExpiredSSTables(Sets.difference(candidates, expired), gcBefore)); if (!expired.isEmpty()) { logger.debug("Including expired sstables: {}", expired); compactionCandidates.addAll(expired); } return compactionCandidates; }