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" ) ; public final Table table ; public final String columnFamily ; public final CFMetaData metadata ; public final IPartitioner partitioner ; private final String mbeanName ; private boolean invalid = false ; private final DataTracker data ; private volatile int memtableSwitchCount = 0 ; private AtomicInteger fileIndexGenerator = new AtomicInteger ( 0 ) ; private final ConcurrentSkipListMap < ByteBuffer , ColumnFamilyStore > indexedColumns ; private AtomicReference < BinaryMemtable > binaryMemtable ; private LatencyTracker readStats = new LatencyTracker ( ) ; private LatencyTracker writeStats = new LatencyTracker ( ) ; private final EstimatedHistogram recentSSTablesPerRead = new EstimatedHistogram ( 35 ) ; private final EstimatedHistogram sstablesPerRead = new EstimatedHistogram ( 35 ) ; private static final int INTERN_CUTOFF = 256 ; public final ConcurrentMap < ByteBuffer , ByteBuffer > internedNames = new org . cliffc . high_scale_lib . NonBlockingHashMap < ByteBuffer , ByteBuffer > ( ) ; 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 ( ) ; public static enum CacheType { KEY_CACHE_TYPE ( "KeyCache" ) , ROW_CACHE_TYPE ( "RowCache" ) ; public final String name ; private CacheType ( String name ) { } @ Override public String toString ( ) { } } public final AutoSavingCache < Pair < Descriptor , DecoratedKey > , Long > keyCache ; public final AutoSavingCache < DecoratedKey , ColumnFamily > rowCache ; volatile double liveRatio = 1.0 ; private final AtomicLong liveRatioComputedAt = new AtomicLong ( 32 ) ; public void reload ( ) { } void removeIndex ( ByteBuffer indexedColumn ) { } private ColumnFamilyStore ( Table table , String columnFamilyName , IPartitioner partitioner , int generation , CFMetaData metadata ) { } 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 initCaches ( ) { } public void scheduleCacheSaving ( int rowCacheSavePeriodInSeconds , int keyCacheSavePeriodInSeconds ) { } public AutoSavingCache < Pair < Descriptor , DecoratedKey > , Long > getKeyCache ( ) { } private static Map < Descriptor , Set < Component > > files ( String keyspace , final String columnFamily , final boolean includeCompacted ) { } public String getColumnFamilyName ( ) { } public String getFlushPath ( long estimatedSize ) { } 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 ( ) { } public void updateRowCache ( DecoratedKey key , ColumnFamily columnFamily ) { } Memtable apply ( DecoratedKey key , ColumnFamily columnFamily ) { } void applyBinary ( DecoratedKey key , ByteBuffer buffer ) { }

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