Buggy code:
public class Memtable implements Comparable < Memtable > { private static Logger logger_ = Logger . getLogger ( Memtable . class ) ; private boolean isFrozen_ ; private volatile boolean isDirty_ ; private volatile boolean isFlushed_ ; private int threshold_ = ( ( DatabaseDescriptor . getMemtableSize ( ) ) * 1024 ) * 1024 ; private int thresholdCount_ = ( ( int ) ( ( ( DatabaseDescriptor . getMemtableObjectCount ( ) ) * 1024 ) * 1024 ) ) ; private AtomicInteger currentSize_ = new AtomicInteger ( 0 ) ; private AtomicInteger currentObjectCount_ = new AtomicInteger ( 0 ) ; private String table_ ; private String cfName_ ; private long creationTime_ ; private Map < String , ColumnFamily > columnFamilies_ = new HashMap < String , ColumnFamily > ( ) ; Memtable ( String table , String cfName ) { } public boolean isFlushed ( ) { } public int compareTo ( Memtable rhs ) { } public int getCurrentSize ( ) { } public int getCurrentObjectCount ( ) { } void resolveSize ( int oldSize , int newSize ) { } void resolveCount ( int oldCount , int newCount ) { } boolean isThresholdViolated ( ) { } String getColumnFamily ( ) { } boolean isFrozen ( ) { } void freeze ( ) { } void put ( String key , ColumnFamily columnFamily ) { } void flushOnRecovery ( ) throws IOException { } private void resolve ( String key , ColumnFamily columnFamily ) { } public String contents ( ) { } void flush ( CommitLog . CommitLogContext cLogCtx ) throws IOException { Memtable . logger_ . info ( ( "Flushing<seq2seq4repair_space>" + ( this ) ) ) ; ColumnFamilyStore cfStore = Table . open ( table_ ) . getColumnFamilyStore ( cfName_ ) ; SSTableWriter writer = new SSTableWriter ( cfStore . getTempSSTablePath ( ) , columnFamilies_ . size ( ) , StorageService . getPartitioner ( ) ) ; final IPartitioner partitioner = StorageService . getPartitioner ( ) ; final Comparator < String > dc = partitioner . getDecoratedKeyComparator ( ) ; ArrayList < String > orderedKeys = new ArrayList < String > ( columnFamilies_ . keySet ( ) ) ; Collections . sort ( orderedKeys , new Comparator < String > ( ) { public int compare ( String o1 , String o2 ) { return dc . compare ( partitioner . decorateKey ( o1 ) , partitioner . decorateKey ( o2 ) ) ; } } ) ; DataOutputBuffer buffer = new DataOutputBuffer ( ) ; for ( String key : orderedKeys ) { buffer . reset ( ) ; ColumnFamily columnFamily = columnFamilies_ . get ( key ) ; if ( columnFamily != null ) { ColumnFamily . serializer ( ) . serializeWithIndexes ( columnFamily , buffer ) ; writer . append ( partitioner . decorateKey ( key ) , buffer ) ; } } <START_BUG> SSTableReader ssTable = writer . closeAndOpenReader ( DatabaseDescriptor . getKeysCachedFraction ( table_ ) ) ; <END_BUG> cfStore . onMemtableFlush ( cLogCtx ) ; cfStore . storeLocation ( ssTable ) ; buffer . close ( ) ; isFlushed_ = true ; Memtable . logger_ . info ( ( "Completed<seq2seq4repair_space>flushing<seq2seq4repair_space>" + ( this ) ) ) ; } public String toString ( ) { } Set < String > getKeys ( ) throws InterruptedException , ExecutionException { } public static Iterator < String > getKeyIterator ( Set < String > keys ) { } public boolean isClean ( ) { } public ColumnIterator getSliceIterator ( SliceQueryFilter filter , AbstractType typeComparator ) { } public ColumnIterator getNamesIterator ( final NamesQueryFilter filter ) { } void clearUnsafe ( ) { } }

Fix:
SSTableReader ssTable = writer . closeAndOpenReader ( ) ;