Buggy code:
public class CompactionManager implements CompactionManagerMBean { public static final String MBEAN_OBJECT_NAME = "org.apache.cassandra.db:type=CompactionManager" ; private static final Logger logger = Logger . getLogger ( CompactionManager . class ) ; public static final CompactionManager instance ; private static volatile boolean gcRequested ; private int minimumCompactionThreshold = 4 ; private int maximumCompactionThreshold = 32 ; private CompactionManager . CompactionExecutor executor = new CompactionManager . CompactionExecutor ( ) ; private Map < ColumnFamilyStore , Integer > estimatedCompactions = new org . cliffc . high_scale_lib . NonBlockingHashMap < ColumnFamilyStore , Integer > ( ) ; public Future < Integer > submitMinorIfNeeded ( final ColumnFamilyStore cfs ) { } private void updateEstimateFor ( ColumnFamilyStore cfs , Set < List < SSTableReader > > buckets ) { } public Future < Object > submitCleanup ( final ColumnFamilyStore cfStore ) { } public Future < List < SSTableReader > > submitAnticompaction ( final ColumnFamilyStore cfStore , final Collection < Range > ranges , final InetAddress target ) { } public Future submitMajor ( final ColumnFamilyStore cfStore ) { } public Future submitMajor ( final ColumnFamilyStore cfStore , final long skip , final int gcBefore ) { } public Future submitReadonly ( final ColumnFamilyStore cfStore , final InetAddress initiator ) { } public int getMinimumCompactionThreshold ( ) { } public void setMinimumCompactionThreshold ( int threshold ) { } public int getMaximumCompactionThreshold ( ) { } public void setMaximumCompactionThreshold ( int threshold ) { } public void disableAutoCompaction ( ) { } int doCompaction ( ColumnFamilyStore cfs , Collection < SSTableReader > sstables , int gcBefore ) throws IOException { } private List < SSTableReader > doAntiCompaction ( ColumnFamilyStore cfs , Collection < SSTableReader > sstables , Collection < Range > ranges , InetAddress target ) throws IOException { } private void doCleanupCompaction ( ColumnFamilyStore cfs ) throws IOException { Collection < SSTableReader > originalSSTables = cfs . getSSTables ( ) ; <START_BUG> List < SSTableReader > sstables = doAntiCompaction ( cfs , originalSSTables , StorageService . instance . getLocalRanges ( ) , null ) ; <END_BUG> if ( ! ( sstables . isEmpty ( ) ) ) { cfs . replaceCompactedSSTables ( originalSSTables , sstables ) ; } CompactionManager . gcRequested = true ; } private void doReadonlyCompaction ( ColumnFamilyStore cfs , InetAddress initiator ) throws IOException { } static Set < List < SSTableReader > > getCompactionBuckets ( Iterable < SSTableReader > files , long min ) { } public static int getDefaultGCBefore ( ) { } private static class AntiCompactionIterator extends CompactionIterator { private Set < SSTableScanner > scanners ; public AntiCompactionIterator ( Collection < SSTableReader > sstables , Collection < Range > ranges , int gcBefore , boolean isMajor ) throws IOException { } private static Iterator getCollatedRangeIterator ( Collection < SSTableReader > sstables , final Collection < Range > ranges ) throws IOException { } public Iterable < SSTableScanner > getScanners ( ) { } } public void checkAllColumnFamilies ( ) throws IOException { } private class CompactionExecutor extends DebuggableThreadPoolExecutor { private volatile ColumnFamilyStore cfs ; private volatile CompactionIterator ci ; public CompactionExecutor ( ) { } @ Override public void afterExecute ( Runnable r , Throwable t ) { } void beginCompaction ( ColumnFamilyStore cfs , CompactionIterator ci ) { } public String getColumnFamilyName ( ) { } public Long getBytesTotal ( ) { } public Long getBytesCompleted ( ) { } } public String getColumnFamilyInProgress ( ) { } public Long getBytesTotalInProgress ( ) { } public Long getBytesCompacted ( ) { } public int getPendingTasks ( ) { } }

Fix:
List < SSTableReader > sstables = doAntiCompaction ( cfs , originalSSTables , StorageService . instance . getLocalRanges ( cfs . getTable ( ) . name ) , null ) ;