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 ( List < IndexExpression > clause ) { } private String expressionString ( IndexExpression expr ) { } public boolean isIndexing ( List < IndexExpression > clause ) { } @ Override public List < Row > search ( List < IndexExpression > clause , AbstractBounds < RowPosition > range , int maxResults , IFilter dataFilter , boolean maxIsColumns ) { } public AbstractScanIterator getIndexedIterator ( final AbstractBounds < RowPosition > range , final ExtendedFilter filter ) { final IndexExpression primary = highestSelectivityPredicate ( filter . getClause ( ) ) ; final 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 ; final DecoratedKey indexKey = indexManager . getIndexKeyFor ( primary . column_name , primary . value ) ; final ByteBuffer startKey = ( ( range . left ) instanceof DecoratedKey ) ? ( ( DecoratedKey ) ( range . left ) ) . key : ByteBufferUtil . EMPTY_BYTE_BUFFER ; final ByteBuffer endKey = ( ( range . right ) instanceof DecoratedKey ) ? ( ( DecoratedKey ) ( range . right ) ) . key : ByteBufferUtil . EMPTY_BYTE_BUFFER ; return new ColumnFamilyStore . AbstractScanIterator ( ) { private ByteBuffer lastSeenKey = startKey ; private Iterator < IColumn > indexColumns ; private final QueryPath path = new QueryPath ( baseCfs . columnFamily ) ; private int columnsRead = Integer . MAX_VALUE ; protected Row computeNext ( ) { int meanColumns = Math . max ( index . getIndexCfs ( ) . getMeanColumns ( ) , 1 ) ; int rowsPerQuery = Math . max ( Math . min ( filter . maxRows ( ) , ( ( filter . maxColumns ( ) ) // meanColumns ) ) , 2 ) ; while ( true ) { if ( ( ( indexColumns ) == null ) || ( ! ( indexColumns . hasNext ( ) ) ) ) { if ( ( columnsRead ) < rowsPerQuery ) { KeysSearcher . logger . debug ( "Read<seq2seq4repair_space>only<seq2seq4repair_space>{}<seq2seq4repair_space>(<<seq2seq4repair_space>{})<seq2seq4repair_space>last<seq2seq4repair_space>page<seq2seq4repair_space>through,<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>done" , columnsRead , rowsPerQuery ) ; return endOfData ( ) ; } if ( KeysSearcher . logger . isDebugEnabled ( ) ) KeysSearcher . logger . debug ( String . format ( "Scanning<seq2seq4repair_space>index<seq2seq4repair_space>%s<seq2seq4repair_space>starting<seq2seq4repair_space>with<seq2seq4repair_space>%s" , expressionString ( primary ) , index . getBaseCfs ( ) . metadata . getKeyValidator ( ) . getString ( startKey ) ) ) ; QueryFilter indexFilter = QueryFilter . getSliceFilter ( indexKey , new QueryPath ( index . getIndexCfs ( ) . getColumnFamilyName ( ) ) , lastSeenKey , endKey , false , rowsPerQuery ) ; ColumnFamily indexRow = index . getIndexCfs ( ) . getColumnFamily ( indexFilter ) ; KeysSearcher . logger . debug ( "fetched<seq2seq4repair_space>{}" , indexRow ) ; if ( indexRow == null ) { KeysSearcher . logger . debug ( "no<seq2seq4repair_space>data,<seq2seq4repair_space>all<seq2seq4repair_space>done" ) ; return endOfData ( ) ; } Collection < IColumn > sortedColumns = indexRow . getSortedColumns ( ) ; columnsRead = sortedColumns . size ( ) ; indexColumns = sortedColumns . iterator ( ) ; IColumn firstColumn = sortedColumns . iterator ( ) . next ( ) ; if ( ( ( lastSeenKey ) != startKey ) && ( lastSeenKey . equals ( firstColumn . name ( ) ) ) ) { indexColumns . next ( ) ; ( columnsRead ) -- ; <START_BUG> KeysSearcher . logger . debug ( "Skipping<seq2seq4repair_space>{}" , baseCfs . getComparator ( ) . getString ( firstColumn . name ( ) ) ) ; <END_BUG> } else if ( ( ( range instanceof Range ) && ( indexColumns . hasNext ( ) ) ) && ( firstColumn . equals ( startKey ) ) ) { indexColumns . next ( ) ; ( columnsRead ) -- ; KeysSearcher . logger . debug ( "Skipping<seq2seq4repair_space>first<seq2seq4repair_space>key<seq2seq4repair_space>as<seq2seq4repair_space>range<seq2seq4repair_space>excludes<seq2seq4repair_space>it" ) ; } } while ( indexColumns . hasNext ( ) ) { IColumn column = indexColumns . next ( ) ; lastSeenKey = column . name ( ) ; if ( column . isMarkedForDelete ( ) ) { KeysSearcher . logger . debug ( "skipping<seq2seq4repair_space>{}" , column . name ( ) ) ; continue ; } DecoratedKey dk = partitioner . decorateKey ( lastSeenKey ) ; if ( ( ! ( range . right . isMinimum ( partitioner ) ) ) && ( ( range . right . compareTo ( dk ) ) < 0 ) ) { KeysSearcher . logger . debug ( "Reached<seq2seq4repair_space>end<seq2seq4repair_space>of<seq2seq4repair_space>assigned<seq2seq4repair_space>scan<seq2seq4repair_space>range" ) ; return endOfData ( ) ; } if ( ! ( range . contains ( dk ) ) ) { KeysSearcher . logger . debug ( "Skipping<seq2seq4repair_space>entry<seq2seq4repair_space>{}<seq2seq4repair_space>outside<seq2seq4repair_space>of<seq2seq4repair_space>assigned<seq2seq4repair_space>scan<seq2seq4repair_space>range" , dk . token ) ; continue ; } KeysSearcher . logger . debug ( "Returning<seq2seq4repair_space>index<seq2seq4repair_space>hit<seq2seq4repair_space>for<seq2seq4repair_space>{}" , dk ) ; ColumnFamily data = baseCfs . getColumnFamily ( new QueryFilter ( dk , path , filter . initialFilter ( ) ) ) ; if ( data == null ) data = ColumnFamily . create ( metadata ) ; return new Row ( dk , data ) ; } } } public void close ( ) throws IOException { } } ; } }

Fix:
KeysSearcher . logger . debug ( "Skipping<seq2seq4repair_space>{}" , metadata . getKeyValidator ( ) . getString ( firstColumn . name ( ) ) ) ;