Program: 7140
Project: 7140
Buggy source:
@Override void upgrade() throws Exception {
  TableId tableId=getTableId();
  if (!tableUtil.tableExists(new HBaseAdmin(conf),tableId)) {
    LOG.info("String_Node_Str",tableId);
    return;
  }
  HTable hTable=tableUtil.createHTable(conf,tableId);
  LOG.info("String_Node_Str",Bytes.toString(hTable.getTableName()));
  try {
    Scan scan=new Scan();
    scan.setTimeRange(0,HConstants.LATEST_TIMESTAMP);
    scan.addFamily(QueueEntryRow.COLUMN_FAMILY);
    scan.setMaxVersions(1);
    List<Mutation> mutations=Lists.newArrayList();
    Result result;
    ResultScanner resultScanner=hTable.getScanner(scan);
    try {
      while ((result=resultScanner.next()) != null) {
        byte[] row=result.getRow();
        String rowKeyString=Bytes.toString(row);
        byte[] newKey=processRowKey(row);
        NavigableMap<byte[],byte[]> columnsMap=result.getFamilyMap(QueueEntryRow.COLUMN_FAMILY);
        if (newKey != null) {
          Put put=new Put(newKey);
          for (          NavigableMap.Entry<byte[],byte[]> entry : columnsMap.entrySet()) {
            LOG.debug("String_Node_Str",Bytes.toString(entry.getKey()),Bytes.toString(entry.getValue()));
            put.add(QueueEntryRow.COLUMN_FAMILY,entry.getKey(),entry.getValue());
            mutations.add(put);
          }
          LOG.debug("String_Node_Str",rowKeyString);
          mutations.add(new Delete(row));
        }
        LOG.info("String_Node_Str",rowKeyString);
      }
    }
  finally {
      resultScanner.close();
    }
    hTable.batch(mutations);
    LOG.info("String_Node_Str",Bytes.toString(hTable.getTableName()));
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",tableId,e);
    throw Throwables.propagate(e);
  }
 finally {
    hTable.close();
  }
}

Fixed version (ground truth):
@Override void upgrade() throws Exception {
  TableId tableId=getTableId();
  if (!tableUtil.tableExists(new HBaseAdmin(conf),tableId)) {
    LOG.info("String_Node_Str",tableId);
    return;
  }
  HTable hTable=tableUtil.createHTable(conf,tableId);
  ProjectInfo.Version tableVersion=AbstractHBaseDataSetAdmin.getVersion(hTable.getTableDescriptor());
  if (ProjectInfo.getVersion().compareTo(tableVersion) <= 0) {
    LOG.info("String_Node_Str",tableId,tableVersion);
    return;
  }
  LOG.info("String_Node_Str",Bytes.toString(hTable.getTableName()));
  try {
    Scan scan=new Scan();
    scan.setTimeRange(0,HConstants.LATEST_TIMESTAMP);
    scan.addFamily(QueueEntryRow.COLUMN_FAMILY);
    scan.setMaxVersions(1);
    List<Mutation> mutations=Lists.newArrayList();
    Result result;
    ResultScanner resultScanner=hTable.getScanner(scan);
    try {
      while ((result=resultScanner.next()) != null) {
        byte[] row=result.getRow();
        String rowKeyString=Bytes.toString(row);
        byte[] newKey=processRowKey(row);
        NavigableMap<byte[],byte[]> columnsMap=result.getFamilyMap(QueueEntryRow.COLUMN_FAMILY);
        if (newKey != null) {
          Put put=new Put(newKey);
          for (          NavigableMap.Entry<byte[],byte[]> entry : columnsMap.entrySet()) {
            LOG.debug("String_Node_Str",Bytes.toString(entry.getKey()),Bytes.toString(entry.getValue()));
            put.add(QueueEntryRow.COLUMN_FAMILY,entry.getKey(),entry.getValue());
            mutations.add(put);
          }
          LOG.debug("String_Node_Str",rowKeyString);
          mutations.add(new Delete(row));
        }
        LOG.info("String_Node_Str",rowKeyString);
      }
    }
  finally {
      resultScanner.close();
    }
    hTable.batch(mutations);
    LOG.info("String_Node_Str",Bytes.toString(hTable.getTableName()));
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",tableId,e);
    throw Throwables.propagate(e);
  }
 finally {
    hTable.close();
  }
}