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 = LoggerFactory . getLogger ( CompactionManager . class ) ; public static final CompactionManager instance ; private final ReentrantReadWriteLock compactionLock = new ReentrantReadWriteLock ( ) ; private CompactionManager . CompactionExecutor executor = new CompactionManager . CompactionExecutor ( ) ; private Map < ColumnFamilyStore , Integer > estimatedCompactions = new org . cliffc . high_scale_lib . NonBlockingHashMap < ColumnFamilyStore , Integer > ( ) ; public Lock getCompactionLock ( ) { } public Future < Integer > submitMinorIfNeeded ( final ColumnFamilyStore cfs ) { } private void updateEstimateFor ( ColumnFamilyStore cfs , Set < List < SSTableReader > > buckets ) { } public void performCleanup ( final ColumnFamilyStore cfStore , final NodeId . OneShotRenewer renewer ) throws InterruptedException , ExecutionException { } public void performScrub ( final ColumnFamilyStore cfStore ) throws InterruptedException , ExecutionException { } public void performMajor ( final ColumnFamilyStore cfStore ) throws InterruptedException , ExecutionException { } public Future < Object > submitMajor ( final ColumnFamilyStore cfStore , final long skip , final int gcBefore ) { } public void forceUserDefinedCompaction ( String ksname , String dataFiles ) { } public Future < Object > submitUserDefined ( final ColumnFamilyStore cfs , final Collection < Descriptor > dataFiles , final int gcBefore ) { } private SSTableReader lookupSSTable ( final ColumnFamilyStore cfs , Descriptor descriptor ) { } public Future < Object > submitValidation ( final ColumnFamilyStore cfStore , final AntiEntropyService . Validator validator ) { } public void disableAutoCompaction ( ) { } int doCompaction ( ColumnFamilyStore cfs , Collection < SSTableReader > sstables , int gcBefore ) throws IOException { } int doCompactionWithoutSizeEstimation ( ColumnFamilyStore cfs , Collection < SSTableReader > sstables , int gcBefore , String compactionFileLocation ) throws IOException { assert sstables != null ; Table table = cfs . table ; if ( DatabaseDescriptor . isSnapshotBeforeCompaction ( ) ) <START_BUG> table . snapshot ( ( "compact-" + ( cfs . columnFamily ) ) ) ; <END_BUG> for ( SSTableReader sstable : sstables ) assert sstable . descriptor . cfname . equals ( cfs . columnFamily ) ; boolean major = cfs . isCompleteSSTables ( sstables ) ; CompactionType type = ( major ) ? CompactionType . MAJOR : CompactionType . MINOR ; CompactionManager . logger . info ( "Compacting<seq2seq4repair_space>{}:<seq2seq4repair_space>{}" , type , sstables ) ; long startTime = System . currentTimeMillis ( ) ; long totalkeysWritten = 0 ; int expectedBloomFilterSize = Math . max ( DatabaseDescriptor . getIndexInterval ( ) , ( ( int ) ( SSTableReader . getApproximateKeyCount ( sstables ) ) ) ) ; if ( CompactionManager . logger . isDebugEnabled ( ) ) CompactionManager . logger . debug ( ( "Expected<seq2seq4repair_space>bloom<seq2seq4repair_space>filter<seq2seq4repair_space>size<seq2seq4repair_space>:<seq2seq4repair_space>" + expectedBloomFilterSize ) ) ; SSTableWriter writer ; CompactionController controller = new CompactionController ( cfs , sstables , major , gcBefore , false ) ; CompactionIterator ci = new CompactionIterator ( type , sstables , controller ) ; Iterator < AbstractCompactedRow > nni = new FilterIterator ( ci , PredicateUtils . notNullPredicate ( ) ) ; Map < DecoratedKey , Long > cachedKeys = new HashMap < DecoratedKey , Long > ( ) ; executor . beginCompaction ( ci ) ; try { if ( ! ( nni . hasNext ( ) ) ) { cfs . markCompacted ( sstables ) ; return 0 ; } writer = cfs . createCompactionWriter ( expectedBloomFilterSize , compactionFileLocation ) ; while ( nni . hasNext ( ) ) { AbstractCompactedRow row = nni . next ( ) ; long position = writer . append ( row ) ; totalkeysWritten ++ ; if ( DatabaseDescriptor . getPreheatKeyCache ( ) ) { for ( SSTableReader sstable : sstables ) { if ( ( sstable . getCachedPosition ( row . key ) ) != null ) { cachedKeys . put ( row . key , position ) ; break ; } } } } } finally { ci . close ( ) ; executor . finishCompaction ( ci ) ; } SSTableReader ssTable = writer . closeAndOpenReader ( CompactionManager . getMaxDataAge ( sstables ) ) ; cfs . replaceCompactedSSTables ( sstables , Arrays . asList ( ssTable ) ) ; for ( Map . Entry < DecoratedKey , Long > entry : cachedKeys . entrySet ( ) ) ssTable . cacheKey ( entry . getKey ( ) , entry . getValue ( ) ) ; submitMinorIfNeeded ( cfs ) ; long dTime = ( System . currentTimeMillis ( ) ) - startTime ; long startsize = SSTable . getTotalBytes ( sstables ) ; long endsize = ssTable . length ( ) ; double ratio = ( ( double ) ( endsize ) ) // ( ( double ) ( startsize ) ) ; CompactionManager . logger . info ( String . format ( "Compacted<seq2seq4repair_space>to<seq2seq4repair_space>%s.<seq2seq4repair_space>%,d<seq2seq4repair_space>to<seq2seq4repair_space>%,d<seq2seq4repair_space>(~%d%%<seq2seq4repair_space>of<seq2seq4repair_space>original)<seq2seq4repair_space>bytes<seq2seq4repair_space>for<seq2seq4repair_space>%,d<seq2seq4repair_space>keys.<seq2seq4repair_space>Time:<seq2seq4repair_space>%,dms." , writer . getFilename ( ) , startsize , endsize , ( ( int ) ( ratio * 100 ) ) , totalkeysWritten , dTime ) ) ; return sstables . size ( ) ; } private static long getMaxDataAge ( Collection < SSTableReader > sstables ) { } private void doScrub ( ColumnFamilyStore cfs , Collection < SSTableReader > sstables ) throws IOException { } private void throwIfFatal ( Throwable th ) { } private void doCleanupCompaction ( ColumnFamilyStore cfs , Collection < SSTableReader > sstables , NodeId . OneShotRenewer renewer ) throws IOException { } private AbstractCompactedRow getCompactedRow ( SSTableIdentityIterator row , Descriptor descriptor , boolean forceDeserialize ) { } private SSTableWriter maybeCreateWriter ( ColumnFamilyStore cfs , String compactionFileLocation , int expectedBloomFilterSize , SSTableWriter writer ) throws IOException { } private void doValidationCompaction ( ColumnFamilyStore cfs , AntiEntropyService . Validator validator ) throws IOException { } static < T > Set < List < T > > getBuckets ( Collection < Pair < T , Long > > files , long min ) { }

Fix:
table . snapshot ( ( ( ( ( System . currentTimeMillis ( ) ) + "-" ) + "compact-" ) + ( cfs . columnFamily ) ) ) ;