Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Ambari database schema upgrade fail while doing Ambari upgrade from 2.6.2.2 to 2.7.3

Highlighted

Ambari database schema upgrade fail while doing Ambari upgrade from 2.6.2.2 to 2.7.3

New Contributor

I'm upgrading ambari server version 2.6.2.2 to version 2.7.3, And stuck while upgrading the Ambari database schema. Any help would be highly appreciated.

Stack Trace :

2019-07-06 12:59:39,666 ERROR [main] SchemaUpgradeHelper:475 - Exception occurred during upgrade, failed

org.apache.ambari.server.AmbariException: Can't create table `ambaridb`.`kerberos_keytab_principal` (errno: 150 "Foreign key constraint is incorrectly formed")

at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:210)

at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:450)

Caused by: java.sql.SQLException: Can't create table `ambaridb`.`kerberos_keytab_principal` (errno: 150 "Foreign key constraint is incorrectly formed")

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4187)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4119)

at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2570)

at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2731)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2814)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2763)

at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:896)

at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:734)

at org.apache.ambari.server.orm.DBAccessorImpl.executeQuery(DBAccessorImpl.java:872)

at org.apache.ambari.server.orm.DBAccessorImpl.addFKConstraint(DBAccessorImpl.java:512)

at org.apache.ambari.server.orm.DBAccessorImpl.addFKConstraint(DBAccessorImpl.java:477)

at org.apache.ambari.server.upgrade.UpgradeCatalog270.upgradeKerberosTables(UpgradeCatalog270.java:1035)

at org.apache.ambari.server.upgrade.UpgradeCatalog270.executeDDLUpdates(UpgradeCatalog270.java:322)

at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.upgradeSchema(AbstractUpgradeCatalog.java:970)

at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:207)

... 1 more

2 REPLIES 2

Re: Ambari database schema upgrade fail while doing Ambari upgrade from 2.6.2.2 to 2.7.3

Super Mentor

@Arshadullah Khan

What is the exact DB type that you are using MariaDB (10.2) ? MySQL (5.7) ? Also please let us know the DB exact version which you are using?

Is it listed in the Supported DB? : https://supportmatrix.hortonworks.com/


Can you also share the output of the following SQL queries so that we can check and compare the "" defined for the column in the following tables to find out if they are "utf-8" or "latin1" ?

mysql=> SELECT character_set_name FROM information_schema.`COLUMNS` 
WHERE  table_name = "kerberos_keytab_principal"  AND column_name = "principal_name";

And

mysql=> SELECT character_set_name FROM information_schema.`COLUMNS` 
WHERE  table_name = "kerberos_principal"  AND column_name = "principal_name";


Ideally they should be: https://github.com/apache/ambari/blob/release-2.7.3/ambari-server/src/main/resources/Ambari-DDL-MySQ...

.

Re: Ambari database schema upgrade fail while doing Ambari upgrade from 2.6.2.2 to 2.7.3

New Contributor

Hi Arshadullah Khan ,

I can share my experience. Recently ,I upgraded my Ambari 2.7.3. So my previous DB version was MySql 5.6 and I installed a new version 5.7 in another server and imported the dump in new mysql 5.7 . During the migration , I just switched it to new DB and it handled all the changes automatically.

Don't have an account?
Coming from Hortonworks? Activate your account here