Buggy code:
public class ColumnFamilyStore implements ColumnFamilyStoreMBean { private static Logger logger = LoggerFactory . getLogger ( ColumnFamilyStore . class ) ; private static final ExecutorService flushSorter = new JMXEnabledThreadPoolExecutor ( Runtime . getRuntime ( ) . availableProcessors ( ) , StageManager . KEEPALIVE , TimeUnit . SECONDS , new LinkedBlockingQueue < Runnable > ( Runtime . getRuntime ( ) . availableProcessors ( ) ) , new NamedThreadFactory ( "FlushSorter" ) , "internal" ) ; private static final ExecutorService flushWriter = new JMXEnabledThreadPoolExecutor ( DatabaseDescriptor . getFlushWriters ( ) , StageManager . KEEPALIVE , TimeUnit . SECONDS , new LinkedBlockingQueue < Runnable > ( DatabaseDescriptor . getFlushQueueSize ( ) ) , new NamedThreadFactory ( "FlushWriter" ) , "internal" ) ; public static final ExecutorService postFlushExecutor = new JMXEnabledThreadPoolExecutor ( "MemtablePostFlusher" ) ; private Set < Memtable > memtablesPendingFlush = new ConcurrentSkipListSet < Memtable > ( ) ; public final Table table ; public final String columnFamily ; public final IPartitioner partitioner ; private final String mbeanName ; private boolean invalid = false ; private volatile int memtableSwitchCount = 0 ; private AtomicInteger fileIndexGenerator = new AtomicInteger ( 0 ) ; private Memtable memtable ; private final ConcurrentSkipListMap < ByteBuffer , ColumnFamilyStore > indexedColumns ; private AtomicReference < BinaryMemtable > binaryMemtable ; private SSTableTracker ssTables ; private LatencyTracker readStats = new LatencyTracker ( ) ; private LatencyTracker writeStats = new LatencyTracker ( ) ; private final EstimatedHistogram recentSSTablesPerRead = new EstimatedHistogram ( 35 ) ; private final EstimatedHistogram sstablesPerRead = new EstimatedHistogram ( 35 ) ; public final CFMetaData metadata ; private volatile DefaultInteger minCompactionThreshold ; private volatile DefaultInteger maxCompactionThreshold ; private volatile DefaultInteger memtime ; private volatile DefaultInteger memsize ; private volatile DefaultDouble memops ; private volatile DefaultInteger rowCacheSaveInSeconds ; private volatile DefaultInteger keyCacheSaveInSeconds ; public final Lock flushLock = new ReentrantLock ( ) ; private volatile ScheduledFuture < ? > saveRowCacheTask ; private volatile ScheduledFuture < ? > saveKeyCacheTask ; public void reload ( ) { } void removeIndex ( ByteBuffer indexedColumn ) { } private ColumnFamilyStore ( Table table , String columnFamilyName , IPartitioner partitioner , int generation , CFMetaData metadata ) { } protected Set < DecoratedKey > readSavedCache ( File path ) { } public Future < ? > addIndex ( final ColumnDefinition info ) { assert ( info . getIndexType ( ) ) != null ; IPartitioner rowPartitioner = StorageService . getPartitioner ( ) ; AbstractType columnComparator = ( ( rowPartitioner instanceof OrderPreservingPartitioner ) || ( rowPartitioner instanceof ByteOrderedPartitioner ) ) ? BytesType . instance : new org . apache . cassandra . db . marshal . LocalByPartionerType ( StorageService . getPartitioner ( ) ) ; final CFMetaData indexedCfMetadata = CFMetaData . newIndexMetadata ( metadata , info , columnComparator ) ; <START_BUG> ColumnFamilyStore indexedCfs = ColumnFamilyStore . createColumnFamilyStore ( table , indexedCfMetadata . cfName , new LocalPartitioner ( metadata . getColumn_metadata ( ) . get ( info . name ) . validator ) , indexedCfMetadata ) ; <END_BUG> if ( ( indexedColumns . putIfAbsent ( info . name , indexedCfs ) ) != null ) return null ; if ( indexedCfs . isIndexBuilt ( ) ) return null ; Runnable runnable = new Runnable ( ) { public void run ( ) { try { forceBlockingFlush ( ) ; } catch ( ExecutionException e ) { throw new RuntimeException ( e ) ; } catch ( InterruptedException e ) { throw new AssertionError ( e ) ; } buildSecondaryIndexes ( getSSTables ( ) , FBUtilities . singleton ( info . name ) ) ; SystemTable . setIndexBuilt ( table . name , indexedCfMetadata . cfName ) ; } } ; FutureTask < ? > f = new FutureTask < Object > ( runnable , null ) ; new Thread ( f , ( "Create<seq2seq4repair_space>index<seq2seq4repair_space>" + ( indexedCfMetadata . cfName ) ) ) . start ( ) ; return f ; } public void buildSecondaryIndexes ( Collection < SSTableReader > sstables , SortedSet < ByteBuffer > columns ) { } void unregisterMBean ( ) { } public long getMinRowSize ( ) { } public long getMaxRowSize ( ) { } public long getMeanRowSize ( ) { } public int getMeanColumns ( ) { } public static ColumnFamilyStore createColumnFamilyStore ( Table table , String columnFamily ) { } public static synchronized ColumnFamilyStore createColumnFamilyStore ( Table table , String columnFamily , IPartitioner partitioner , CFMetaData metadata ) { } public static void scrubDataDirectories ( String table , String columnFamily ) { } public void initRowCache ( ) { } public void scheduleCacheSaving ( int rowCacheSavePeriodInSeconds , int keyCacheSavePeriodInSeconds ) { } public Future < ? > submitRowCacheWrite ( ) { } public Future < ? > submitKeyCacheWrite ( ) { } private static Map < Descriptor , Set < Component > > files ( String keyspace , final String columnFamily , final boolean includeCompacted ) { } public String getColumnFamilyName ( ) { } public String getFlushPath ( ) { } public String getFlushPath ( String version ) { } public String getTempSSTablePath ( String directory , String version ) { } public String getTempSSTablePath ( String directory ) { } Future < ? > maybeSwitchMemtable ( Memtable oldMemtable , final boolean writeCommitLog ) { } public boolean isDropped ( ) { } void switchBinaryMemtable ( DecoratedKey key , ByteBuffer buffer ) { } public void forceFlushIfExpired ( ) { } public Future < ? > forceFlush ( ) { } public void forceBlockingFlush ( ) throws InterruptedException , ExecutionException { } public void forceFlushBinary ( ) { } Memtable apply ( DecoratedKey key , ColumnFamily columnFamily ) { } void applyBinary ( DecoratedKey key , ByteBuffer buffer ) { } public static ColumnFamily removeDeletedCF ( ColumnFamily cf , int gcBefore ) { } public static ColumnFamily removeDeleted ( ColumnFamily cf , int gcBefore ) { } private static void removeDeletedColumnsOnly ( ColumnFamily cf , int gcBefore ) { } private static void removeDeletedStandard ( ColumnFamily cf , int gcBefore ) { }

Fix:
ColumnFamilyStore indexedCfs = ColumnFamilyStore . createColumnFamilyStore ( table , indexedCfMetadata . cfName , new LocalPartitioner ( metadata . getColumn_metadata ( ) . get ( info . name ) . getValidator ( ) ) , indexedCfMetadata ) ;