Buggy code:
public class KeysSearcher extends SecondaryIndexSearcher { private static final Logger logger = LoggerFactory . getLogger ( KeysSearcher . class ) ; public KeysSearcher ( SecondaryIndexManager indexManager , Set < ByteBuffer > columns ) { } private IndexExpression highestSelectivityPredicate ( IndexClause clause ) { } private String expressionString ( IndexExpression expr ) { } private static boolean isIdentityFilter ( SliceQueryFilter filter ) { } @ Override public List < Row > search ( IndexClause clause , AbstractBounds range , IFilter dataFilter ) { IndexExpression primary = highestSelectivityPredicate ( clause ) ; SecondaryIndex index = indexManager . getIndexForColumn ( primary . column_name ) ; if ( KeysSearcher . logger . isDebugEnabled ( ) ) KeysSearcher . logger . debug ( ( "Primary<seq2seq4repair_space>scan<seq2seq4repair_space>clause<seq2seq4repair_space>is<seq2seq4repair_space>" + ( baseCfs . getComparator ( ) . getString ( primary . column_name ) ) ) ) ; assert index != null ; DecoratedKey indexKey = indexManager . getIndexKeyFor ( primary . column_name , primary . value ) ; IFilter firstFilter = dataFilter ; if ( dataFilter instanceof SliceQueryFilter ) { if ( ( baseCfs . getMaxRowSize ( ) ) < ( DatabaseDescriptor . getColumnIndexSize ( ) ) ) { KeysSearcher . logger . debug ( "Expanding<seq2seq4repair_space>slice<seq2seq4repair_space>filter<seq2seq4repair_space>to<seq2seq4repair_space>entire<seq2seq4repair_space>row<seq2seq4repair_space>to<seq2seq4repair_space>cover<seq2seq4repair_space>additional<seq2seq4repair_space>expressions" ) ; firstFilter = new SliceQueryFilter ( ByteBufferUtil . EMPTY_BYTE_BUFFER , ByteBufferUtil . EMPTY_BYTE_BUFFER , ( ( SliceQueryFilter ) ( dataFilter ) ) . reversed , Integer . MAX_VALUE ) ; } } else { KeysSearcher . logger . debug ( "adding<seq2seq4repair_space>columns<seq2seq4repair_space>to<seq2seq4repair_space>firstFilter<seq2seq4repair_space>to<seq2seq4repair_space>cover<seq2seq4repair_space>additional<seq2seq4repair_space>expressions" ) ; assert dataFilter instanceof NamesQueryFilter ; SortedSet < ByteBuffer > columns = new TreeSet < ByteBuffer > ( baseCfs . getComparator ( ) ) ; for ( IndexExpression expr : clause . expressions ) { columns . add ( expr . column_name ) ; } if ( ( columns . size ( ) ) > 0 ) { columns . addAll ( ( ( NamesQueryFilter ) ( dataFilter ) ) . columns ) ; firstFilter = new NamesQueryFilter ( columns ) ; } } List < Row > rows = new ArrayList < Row > ( ) ; ByteBuffer startKey = clause . start_key ; QueryPath path = new QueryPath ( baseCfs . columnFamily ) ; ByteBuffer lastDataKey = null ; outer : while ( true ) { if ( KeysSearcher . logger . isDebugEnabled ( ) ) <START_BUG> KeysSearcher . logger . debug ( String . format ( "Scanning<seq2seq4repair_space>index<seq2seq4repair_space>%s<seq2seq4repair_space>starting<seq2seq4repair_space>with<seq2seq4repair_space>%s" , expressionString ( primary ) , index . getUnderlyingCfs ( ) . getComparator ( ) . getString ( startKey ) ) ) ; <END_BUG> int count = Math . max ( clause . count , 2 ) ; QueryFilter indexFilter = QueryFilter . getSliceFilter ( indexKey , new QueryPath ( index . getUnderlyingCfs ( ) . getColumnFamilyName ( ) ) , startKey , EMPTY_BYTE_BUFFER , false , count ) ; ColumnFamily indexRow = index . getUnderlyingCfs ( ) . getColumnFamily ( indexFilter ) ; KeysSearcher . logger . debug ( "fetched<seq2seq4repair_space>{}" , indexRow ) ; if ( indexRow == null ) break ; ByteBuffer dataKey = null ; int n = 0 ; for ( IColumn column : indexRow . getSortedColumns ( ) ) { if ( column . isMarkedForDelete ( ) ) { KeysSearcher . logger . debug ( "skipping<seq2seq4repair_space>{}" , column . name ( ) ) ; continue ; } dataKey = column . name ( ) ; n ++ ; if ( KeysSearcher . logger . isDebugEnabled ( ) ) KeysSearcher . logger . debug ( "fetching<seq2seq4repair_space>{}" , column . name ( ) ) ; DecoratedKey dk = partitioner . decorateKey ( dataKey ) ; if ( ( ! ( range . right . equals ( partitioner . getMinimumToken ( ) ) ) ) && ( ( range . right . compareTo ( dk . token ) ) < 0 ) ) break outer ; if ( ( ! ( range . contains ( dk . token ) ) ) || ( dataKey . equals ( lastDataKey ) ) ) continue ; ColumnFamily data = baseCfs . getColumnFamily ( new QueryFilter ( dk , path , firstFilter ) ) ; if ( data == null ) data = ColumnFamily . create ( metadata ) ; KeysSearcher . logger . debug ( "fetched<seq2seq4repair_space>data<seq2seq4repair_space>row<seq2seq4repair_space>{}" , data ) ; NamesQueryFilter extraFilter = null ; if ( ( dataFilter instanceof SliceQueryFilter ) && ( ! ( KeysSearcher . isIdentityFilter ( ( ( SliceQueryFilter ) ( dataFilter ) ) ) ) ) ) { boolean needExtraFilter = false ; for ( IndexExpression expr : clause . expressions ) { if ( ( data . getColumn ( expr . column_name ) ) == null ) { KeysSearcher . logger . debug ( "adding<seq2seq4repair_space>extraFilter<seq2seq4repair_space>to<seq2seq4repair_space>cover<seq2seq4repair_space>additional<seq2seq4repair_space>expressions" ) ; needExtraFilter = true ; break ; } } if ( needExtraFilter ) { extraFilter = getExtraFilter ( clause ) ; for ( IndexExpression expr : clause . expressions ) { if ( ( data . getColumn ( expr . column_name ) ) != null ) extraFilter . columns . remove ( expr . column_name ) ; } assert ! ( extraFilter . columns . isEmpty ( ) ) ; ColumnFamily cf = baseCfs . getColumnFamily ( new QueryFilter ( dk , path , extraFilter ) ) ; if ( cf != null ) data . addAll ( cf , instance ) ; } } if ( SecondaryIndexSearcher . satisfies ( data , clause , primary ) ) { KeysSearcher . logger . debug ( "row<seq2seq4repair_space>{}<seq2seq4repair_space>satisfies<seq2seq4repair_space>all<seq2seq4repair_space>clauses" , data ) ; if ( ( firstFilter != dataFilter ) || ( extraFilter != null ) ) { ColumnFamily expandedData = data ; data = expandedData . cloneMeShallow ( ) ; IColumnIterator iter = dataFilter . getMemtableColumnIterator ( expandedData , dk , baseCfs . getComparator ( ) ) ; new QueryFilter ( dk , path , dataFilter ) . collateColumns ( data , Collections . singletonList ( iter ) , baseCfs . getComparator ( ) , baseCfs . gcBefore ( ) ) ; } rows . add ( new Row ( dk , data ) ) ; }

Fix:
KeysSearcher . logger . debug ( String . format ( "Scanning<seq2seq4repair_space>index<seq2seq4repair_space>%s<seq2seq4repair_space>starting<seq2seq4repair_space>with<seq2seq4repair_space>%s" , expressionString ( primary ) , index . getBaseCFStore ( ) . metadata . getKeyValidator ( ) . getString ( startKey ) ) ) ;