private void rollback(SQLException e) throws SQLException {
    logger.error("Failed batch operation on {}, current batch size {}, already committed {}, rolling back", tableName,
        currentBatchSize, committedBatchSize, e);
    try {
      // First try to rollback the transaction, this might fail due to connection error.
      connection.rollback();
    } finally {
      // Then deal with exception, this might close the connection.
      metrics.batchUpdateFailureCount.inc();
      connection.setAutoCommit(autoCommit);
    }
  }
Rollback the transaction due to exception {@code e}.
@param e The {@link SQLException}.
@throws SQLException
ambry-mysql/src/main/java/com/github/ambry/mysql/BatchUpdater.java