private void applyDelete(short accountId, short containerId, String blobName, Timestamp deletedTs,
      List<Long> versions, Connection connection) throws Exception {
    String query = "";
    String deleteTemplate = config.enableHardDelete ? HARD_DELETE_MULTIPLE_VERSIONS_QUERY_TEMPLATE
        : SOFT_DELETE_MULTIPLE_VERSIONS_QUERY_TEMPLATE;
    String deleteStatement = renderMultiVersionTemplate(deleteTemplate, versions.size());
    try (PreparedStatement statement = connection.prepareStatement(deleteStatement)) {
      // use the current time
      int paramInd = 1;
      if (!config.enableHardDelete) {
        // Update statement requires a delete timestamp as first parameter
        statement.setTimestamp(paramInd++, deletedTs);
      }
      statement.setInt(paramInd++, accountId);
      statement.setInt(paramInd++, containerId);
      statement.setString(paramInd++, blobName);
      for (long version : versions) {
        statement.setLong(paramInd++, version);
      }
      query = statement.toString();
      logger.debug("Deleting blob in MySql. Query {}", query);
      statement.executeUpdate();
    } catch (SQLException e) {
      logger.error("Failed to execute query {}, {}", query, e.getMessage());
      throw e;
    }
  }
Delete multiple versions of a a blob name.
@param accountId The account id.
@param containerId The container id.
@param blobName The blob name to delete
@param deletedTs The deleted ts timstamp.
@param versions The list of versions to delete
@param connection The mysql connection.
@throws Exception
ambry-named-mysql/src/main/java/com/github/ambry/named/MySqlNamedBlobDb.java