Program: 7843
Project: 7843
Buggy source:
private void populateRowCache() throws IOException {
  Scan scan=new Scan();
  scan.setCaching(MAX_CACHE_ROWS);
  scan.setStartRow(startRow);
  scan.setStopRow(getStopRow());
  scan.addColumn(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.DATA_COLUMN);
  scan.addColumn(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.META_COLUMN);
  scan.addColumn(HBaseQueueConstants.COLUMN_FAMILY,stateColumnName);
  scan.setMaxVersions();
  long readPointer=transaction.getReadPointer();
  long[] excludedList=transaction.getExcludedList();
  ResultScanner scanner=hTable.getScanner(scan);
  while (entryCache.size() < MAX_CACHE_ROWS) {
    Result[] results=scanner.next(MAX_CACHE_ROWS);
    if (results.length == 0) {
      break;
    }
    for (    Result result : results) {
      byte[] rowKey=result.getRow();
      if (entryCache.containsKey(rowKey) || consumingEntries.containsKey(rowKey)) {
        continue;
      }
      long writePointer=Bytes.toLong(rowKey,queueName.toBytes().length,Longs.BYTES);
      if (writePointer > readPointer) {
        break;
      }
      if (Arrays.binarySearch(excludedList,writePointer) >= 0) {
        continue;
      }
      KeyValue metaColumn=result.getColumnLatest(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.META_COLUMN);
      KeyValue stateColumn=result.getColumnLatest(HBaseQueueConstants.COLUMN_FAMILY,stateColumnName);
      int counter=Bytes.toInt(rowKey,rowKey.length - 4,Ints.BYTES);
      if (!shouldInclude(writePointer,counter,metaColumn,stateColumn)) {
        continue;
      }
      entryCache.put(rowKey,new Entry(rowKey,result.getValue(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.DATA_COLUMN),result.getValue(HBaseQueueConstants.COLUMN_FAMILY,stateColumnName)));
    }
  }
  scanner.close();
}

Fixed version (ground truth):
private void populateRowCache(Set<byte[]> excludeRows) throws IOException {
  Scan scan=new Scan();
  scan.setCaching(MAX_CACHE_ROWS);
  scan.setStartRow(startRow);
  scan.setStopRow(getStopRow());
  scan.addColumn(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.DATA_COLUMN);
  scan.addColumn(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.META_COLUMN);
  scan.addColumn(HBaseQueueConstants.COLUMN_FAMILY,stateColumnName);
  scan.setMaxVersions();
  long readPointer=transaction.getReadPointer();
  long[] excludedList=transaction.getExcludedList();
  ResultScanner scanner=hTable.getScanner(scan);
  while (entryCache.size() < MAX_CACHE_ROWS) {
    Result[] results=scanner.next(MAX_CACHE_ROWS);
    if (results.length == 0) {
      break;
    }
    for (    Result result : results) {
      byte[] rowKey=result.getRow();
      if (excludeRows.contains(rowKey)) {
        continue;
      }
      long writePointer=Bytes.toLong(rowKey,queueName.toBytes().length,Longs.BYTES);
      if (writePointer > readPointer) {
        break;
      }
      if (Arrays.binarySearch(excludedList,writePointer) >= 0) {
        continue;
      }
      KeyValue metaColumn=result.getColumnLatest(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.META_COLUMN);
      KeyValue stateColumn=result.getColumnLatest(HBaseQueueConstants.COLUMN_FAMILY,stateColumnName);
      int counter=Bytes.toInt(rowKey,rowKey.length - 4,Ints.BYTES);
      if (!shouldInclude(writePointer,counter,metaColumn,stateColumn)) {
        continue;
      }
      entryCache.put(rowKey,new Entry(rowKey,result.getValue(HBaseQueueConstants.COLUMN_FAMILY,HBaseQueueConstants.DATA_COLUMN),result.getValue(HBaseQueueConstants.COLUMN_FAMILY,stateColumnName)));
    }
  }
  scanner.close();
}