Support Questions

Find answers, ask questions, and share your expertise

"Upgrade" table missing from Ambari database

Contributor

Hello- I the process of upgrading Ambari to 2.2.1.1 I hit the following error after $ ambari-server upgrade:

06 Apr 2016 13:22:52,129 ERROR [main] SchemaUpgradeHelper:315 - Exception occurred during 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.SchemaUpgradeHelper.executePreDMLUpdates(SchemaUpgradeHelper.java:215)
at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:302)
Caused by: org.apache.ambari.server.AmbariException: Errors found while populating the upgrade table with values for columns upgrade_type and upgrade_package.

Took a look at my (external) Postgres database and found the ambari database does not have an "upgrade" table. I checked another cluster with a similar external Postgres instance and it does have that table.

Should I create the table manually? If so, anyone have the appropriate create statement for the table? If there's a more ambari-friendly way get the tables straight, that would be preferable. Thanks.

1 ACCEPTED SOLUTION

This happened because a record may be missing in the repo_version table. If you insert the record before performing the Ambari Upgrade it should work. You can make sure you have a record for each one of the versions.

SELECT from_version, to_version FROM upgrade;

-- Assuming 2.2.0.0-2041 is missing
INSERT INTO repo_version (repo_version_id, version, display_name, upgrade_package, repositories, stack_id) VALUES (1, '2.2.0.0-2041', 'HDP-2.2.0.0-2041', 'upgrade-2.2', '', (SELECT stack_id FROM stack WHERE stack_version = '2.2'));

View solution in original post

9 REPLIES 9

Contributor

@Brenden Cobb

From what ambari version are you upgrading?

Contributor

Ambari 2.1.2.1

Contributor

I believe, the failure seems to be caused while setting "upgrade_package" column for existing entries in the upgrade DB because there is no repo_version DB entry that matches with the from_version entry for a DOWNGRADE entry in the upgrade table.

However, I do believe the upgrade DB table should exist as it also existed in 2.1.2.1 and we dont delete the table. You can check your DB dump before the upgrade to verify if the table existed

This is happening during the upgrade to Ambari 2.2.0 https://github.com/apache/ambari/blob/release-2.2.1-rc2/ambari-server/src/main/java/org/apache/ambar...

What is the output of running,

SELECT upgrade_id, cluster_id, from_version, to_version, direction, upgrade_package, upgrade_type FROM upgrade;

Basically, you have to populate the upgrade_type and upgrade_pack columns based on the versions used.

Contributor

Thanks, but since I don't have an "upgrade" table I can't run a select.

This happened because a record may be missing in the repo_version table. If you insert the record before performing the Ambari Upgrade it should work. You can make sure you have a record for each one of the versions.

SELECT from_version, to_version FROM upgrade;

-- Assuming 2.2.0.0-2041 is missing
INSERT INTO repo_version (repo_version_id, version, display_name, upgrade_package, repositories, stack_id) VALUES (1, '2.2.0.0-2041', 'HDP-2.2.0.0-2041', 'upgrade-2.2', '', (SELECT stack_id FROM stack WHERE stack_version = '2.2'));

Super Collaborator

I have this in the ambari database, if correct??? because i cant finish the upgrade maybe because ambary detect somenthing wrong into the database, please help me.

ambari=> SELECT from_version, to_version, direction, skip_failures, skip_sc_failures FROM upgrade;
 from_version |  to_version  | direction | skip_failures | skip_sc_failures
--------------+--------------+-----------+---------------+------------------
 2.3.2.0-2950 | 2.4.0.0-169  | UPGRADE   |             1 |                0
 2.3.2.0-2950 | 2.3.2.0-2950 | DOWNGRADE |             0 |                0
 2.3.2.0-2950 | 2.4.0.0-169  | UPGRADE   |             1 |                1


i need to delete somenthing??

3359-333333.png

Contributor

Accepting @Alejandro Fernandez 's answer as this is what we essentially did, but I definitely recommend treading cautiously and of course backup your database before making changes. This does appear to be a bug.

Super Collaborator

Hi:

I need to know if i can delete from database the extra row, also the skip_sc_failures column with value =1 is error or ok??


ambari=> select * from upgrade;
 upgrade_id | cluster_id | request_id | from_version |  to_version  | direction | downgrade_allowed | skip_failures | skip_sc_failures |    upgrade_pac
kage     | upgrade_type
------------+------------+------------+--------------+--------------+-----------+-------------------+---------------+------------------+---------------
---------+--------------
          1 |          2 |        820 | 2.3.2.0-2950 | 2.4.0.0-169  | UPGRADE   |                 1 |             1 |                0 | nonrolling-upg
rade-2.4 | NON_ROLLING
          2 |          2 |        821 | 2.3.2.0-2950 | 2.3.2.0-2950 | DOWNGRADE |                 1 |             0 |                0 | nonrolling-upg
rade-2.4 | NON_ROLLING
          3 |          2 |        894 | 2.3.2.0-2950 | 2.4.0.0-169  | UPGRADE   |                 1 |             1 |                1 | nonrolling-upg
rade-2.4 | NON_ROLLING