-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/44228/
-----------------------------------------------------------

Review request for Ambari, Alejandro Fernandez, Robert Levas, and Robert 
Nettleton.


Bugs: AMBARI-15253
    https://issues.apache.org/jira/browse/AMBARI-15253


Repository: ambari


Description
-------

Upgrade Ambari from 2.1.2.1 to 2.2 fails because of missing -2 which could not 
match the correct {{repo_version}}. Because the upgrade pack is bound to the 
major HDP stack version, we can use a 2nd query to get all versions for the 
stack, and just use that if the query by version fails.

{code}
Fixing database objects owner 
Ambari Server configured for Embedded Postgres. Confirm you have made a backup 
of the Ambari Server database [y/n] (y)? 
Upgrading database schema 
Error output from schema upgrade command: 
java.lang.NullPointerException 
at 
org.apache.ambari.server.upgrade.UpgradeCatalog213.calculateUpgradePackage(UpgradeCatalog213.java:630)
 
at 
org.apache.ambari.server.upgrade.UpgradeCatalog213.populateUpgradeTable(UpgradeCatalog213.java:563)
 
{code}

{code}
5 Feb 2016 21:19:55,871  INFO [main] UpgradeCatalog213:532 - Populating rows 
for the upgrade table record with upgrade_id: 3, cluster_id: 2, from_version: 
2.2.0.0-2041, to_version: 2.2.4.2, direction: UPGRADE
15 Feb 2016 21:19:55,871  INFO [main] UpgradeCatalog213:538 - Updating the 
record's upgrade_type to ROLLING
15 Feb 2016 21:19:55,871  INFO [main] DBAccessorImpl:718 - Executing query: 
UPDATE upgrade SET upgrade_type = 'ROLLING' WHERE upgrade_id = 3
15 Feb 2016 21:19:55,874 ERROR [main] UpgradeCatalog213:580 - Unable to 
populate the upgrade_type and upgrade_package columns of the upgrade table. 
java.lang.NullPointerException
15 Feb 2016 21:19:55,875 ERROR [main] SchemaUpgradeHelper:214 - Upgrade failed. 
org.apache.ambari.server.AmbariException: Errors found while populating the 
upgrade table with values for columns upgrade_type and upgrade_package.
        at 
org.apache.ambari.server.upgrade.UpgradeCatalog213.executeStackUpgradeDDLUpdates(UpgradeCatalog213.java:443)
        at 
org.apache.ambari.server.orm.AmbariJpaLocalTxnInterceptor.invoke(AmbariJpaLocalTxnInterceptor.java:68)
{code}

{code}
 select * from upgrade;
 upgrade_id | cluster_id | request_id | from_version |  to_version  | direction
------------+------------+------------+--------------+--------------+-----------
          1 |          2 |       1295 | 2.2.0.0-2041 | 2.2.4.2-2    | UPGRADE
          2 |          2 |       1296 | 2.2.0.0-2041 | 2.2.0.0-2041 | DOWNGRADE
          3 |          2 |       1299 | 2.2.0.0-2041 | 2.2.4.2      | UPGRADE
          4 |          2 |       1300 | 2.2.0.0-2041 | 2.2.0.0-2041 | DOWNGRADE
          5 |          2 |       1331 | 2.2.0.0-2041 | 2.2.4.2-2    | UPGRADE
          6 |          2 |       1332 | 2.2.0.0-2041 | 2.2.0.0-2041 | DOWNGRADE
          7 |          2 |       1333 | 2.2.0.0-2041 | 2.2.4.2-2    | UPGRADE
          8 |          2 |       1334 | 2.2.0.0-2041 | 2.2.0.0-2041 | DOWNGRADE
          9 |          2 |       1335 | 2.2.0.0-2041 | 2.2.4.2-2    | UPGRADE
         10 |          2 |       1336 | 2.2.0.0-2041 | 2.2.0.0-2041 | DOWNGRADE
         11 |          2 |       1347 | 2.2.0.0-2041 | 2.2.4.2-2    | UPGRADE
(11 rows)
{code}


Diffs
-----

  
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
 14dac79 

Diff: https://reviews.apache.org/r/44228/diff/


Testing
-------

Ran through an upgrade on the problem database. Unit tests pending.


Thanks,

Jonathan Hurley

Reply via email to