@Override
  public List<RepairRequestRecord> getRepairRequestsForPartition(long partitionId) throws SQLException {
    long startTime = time.milliseconds();
    try (Connection connection = dataSource.getConnection()) {
      try (PreparedStatement statement = connection.prepareStatement(GET_REQUESTS_QUERY)) {
        statement.setLong(1, partitionId);
        statement.setInt(2, config.listMaxResults);
        try (ResultSet resultSet = statement.executeQuery()) {
          List<RepairRequestRecord> result = new ArrayList<>();
          while (resultSet.next()) {
            String blobId = Base64.encodeBase64URLSafeString(resultSet.getBytes(1));
            String sourceHostName = resultSet.getString(2);
            int sourceHostPort = resultSet.getInt(3);
            OperationType operationType = OperationType.values()[resultSet.getShort(4)];
            Timestamp operationTime = resultSet.getTimestamp(5);
            short lifeVersion = resultSet.getShort(6);
            Timestamp expirationTime = resultSet.getTimestamp(7);
            RepairRequestRecord record =
                new RepairRequestRecord(blobId, partitionId, sourceHostName, sourceHostPort, operationType,
                    operationTime.getTime(), lifeVersion,
                    expirationTime != null ? expirationTime.getTime() : Utils.Infinite_Time);
            result.add(record);
          }
          metrics.repairDbGetRequestTimeInMs.update(time.milliseconds() - startTime);
          return result;
        }
      }
    } catch (SQLException e) {
      metrics.repairDbErrorGetCount.inc();
      logger.error("failed to get records from {} due to {}", dataSource, e.getMessage());
      throw e;
    }
  }
Select the records for one partition ordered by the operation time.
@param partitionId partition id
@return the oldest {@link RepairRequestRecord}s.
ambry-mysql/src/main/java/com/github/ambry/repair/MysqlRepairRequestsDb.java