public void flush() throws SQLException {
    try {
      executeBatchAndCommit();
      if (startTime != 0) {
        metrics.batchUpdateTimeMs.update(System.currentTimeMillis() - startTime);
      }
      connection.setAutoCommit(autoCommit);
    } catch (SQLException e) {
      rollback(e);
      throw e;
    } finally {
      statement.close();
      connection.close();
    }
  }
Flush all the sql commands added to this batch. If it fails, the batch would be rolled back.
@throws SQLException
ambry-mysql/src/main/java/com/github/ambry/mysql/BatchUpdater.java