private List<StaleNamedBlob> runPullStaleBlobs(final Connection connection) throws Exception {
    String query = "";
    try (PreparedStatement statement = connection.prepareStatement(GET_STALE_QUERY)) {
      Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
      calendar.add(Calendar.DATE, -config.staleDataRetentionDays);
      long previousTimeInMillis = calendar.getTimeInMillis();
      statement.setLong(1, previousTimeInMillis * VERSION_BASE);
      statement.setInt(2, config.queryStaleDataMaxResults);
      query = statement.toString();
      logger.debug("Pulling stale blobs from MySql. Query {}", query);
      try (ResultSet resultSet = statement.executeQuery()) {
        List<StaleNamedBlob> resultList = new ArrayList<>();
        while (resultSet.next()) {
          short accountId = resultSet.getShort(1);
          short containerId = resultSet.getShort(2);
          String blobName = resultSet.getString(3);
          String blobId = Base64.encodeBase64URLSafeString(resultSet.getBytes(4));
          long version = resultSet.getLong(5);
          Timestamp currentTime = resultSet.getTimestamp(6);
          StaleNamedBlob result = new StaleNamedBlob(accountId, containerId, blobName, blobId, version, currentTime);
          resultList.add(result);
        }
        return resultList;
      }
    } catch (SQLException e) {
      logger.error("Failed to execute query {}, {}", query, e.getMessage());
      throw e;
    }
  }
Construct a list query statement with prefix when {@link MySqlNamedBlobDbConfig#listNamedBlobsSQLOption} is 3
@param statement The {@link PreparedStatement} to set the parameters on.
@param accountId The account id
@param containerId The container id
@param blobNamePrefix The blobname prefix
@param pageToken The page token
@param maxKeysValue The max key to return
@throws SQLException
ambry-named-mysql/src/main/java/com/github/ambry/named/MySqlNamedBlobDb.java