Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

"Upgrade" table missing from Ambari database

avatar
Rising Star

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

avatar

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

7 REPLIES 7

avatar
Rising Star

@Brenden Cobb

From what ambari version are you upgrading?

avatar
Rising Star

Ambari 2.1.2.1

avatar
Rising Star

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

avatar

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.

avatar
Rising Star

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

avatar

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'));

avatar
Rising Star

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.