@Override
    public int compare(UpgradeCatalog upgradeCatalog1,
                       UpgradeCatalog upgradeCatalog2) {
      //make sure FinalUpgradeCatalog runs last
      if (upgradeCatalog1.isFinal() ^ upgradeCatalog2.isFinal()) {
        return Boolean.compare(upgradeCatalog1.isFinal(), upgradeCatalog2.isFinal());
      }

      return VersionUtils.compareVersions(upgradeCatalog1.getTargetVersion(),
        upgradeCatalog2.getTargetVersion(), 4);
    }
Fetches the maximum value of the given ID column from the given table.

@param tableName
         the name of the table to query the data from
@param idColumnName
         the name of the ID column you want to query the maximum value for.
         This MUST refer an existing numeric type column
@return the maximum value of the given column in the given table if any;
        <code>0L</code> otherwise.
@throws SQLException
ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java