[ 
https://issues.apache.org/jira/browse/AMBARI-16939?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Balázs Bence Sári updated AMBARI-16939:
---------------------------------------
    Attachment: patch2-trunk.diff

> 'ambari-server upgrade' is failed : Error executing schema upgrade [upgrade 
> from 2200 to 2400]
> ----------------------------------------------------------------------------------------------
>
>                 Key: AMBARI-16939
>                 URL: https://issues.apache.org/jira/browse/AMBARI-16939
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-server
>    Affects Versions: 2.4.0
>            Reporter: Balázs Bence Sári
>            Assignee: Balázs Bence Sári
>            Priority: Blocker
>             Fix For: 2.4.0
>
>         Attachments: patch2-trunk.diff
>
>
> STR:
> 1) Install old version 
> 2) Try to Make ambari only upgrade 
> Cluster: 172.22.123.240
> All logs: 
> http://qelog.hortonworks.com/log/os-u14-xvenls-upg-sanity-u-2200/test-logs/ambari-upgrade-2.2.0.0/
> Actual result:
> 'ambari-server upgrade' is failed : Error executing schema upgrade [upgrade 
> from 2200 to 2400]
> {code}
> 2016-05-19 04:50:31,348 INFO 
> com.hw.ambari.ui.util.cluster_managers.CommandExecutor.executeCommandSequence():
>  Sending command []
> 2016-05-19 04:50:31,950 DEBUG 
> com.hw.ambari.ui.util.cluster_managers.ProcessData.buildOutputAndErrorStreamData():
>  stdin: is not a tty
> 2016-05-19 04:50:49,791 INFO 
> com.hw.ambari.ui.util.cluster_managers.CommandExecutor.executeCommandSequence():
>  [OUTPUT STREAM]
> Using python  /usr/bin/python
> Upgrading ambari-server
> Updating properties in ambari.properties ...
> WARNING: Original file ambari-env.sh kept
> INFO: Loading properties from /etc/ambari-server/conf/ambari.properties
> INFO: Loading properties from /etc/ambari-server/conf/ambari.properties
> INFO: No mpack replay logs found. Skipping replaying mpack commands
> INFO: Loading properties from /etc/ambari-server/conf/ambari.properties
> INFO: Loading properties from /etc/ambari-server/conf/ambari.properties
> Fixing database objects owner
> INFO: Loading properties from /etc/ambari-server/conf/ambari.properties
> INFO: Loading properties from /etc/ambari-server/conf/ambari.properties
> Ambari Server configured for MySQL. Confirm you have made a backup of the 
> Ambari Server database [y/n] (y)? INFO: Loading properties from 
> /etc/ambari-server/conf/ambari.properties
> INFO: Loading properties from /etc/ambari-server/conf/ambari.properties
> Upgrading database schema
> INFO: Loading properties from /etc/ambari-server/conf/ambari.properties
> INFO: Loading properties from /etc/ambari-server/conf/ambari.properties
> INFO: AMBARI_SERVER_LIB is not set, using default /usr/lib/ambari-server
> INFO: Loading properties from /etc/ambari-server/conf/ambari.properties
> INFO: Loading properties from /etc/ambari-server/conf/ambari.properties
> INFO: about to run command: /usr/lib/jvm/java-7-openjdk-amd64/bin/java -cp 
> '/etc/ambari-server/conf:/usr/lib/ambari-server/*:/usr/share/java/mysql-connector-java.jar'
>  org.apache.ambari.server.upgrade.SchemaUpgradeHelper > 
> /var/log/ambari-server/ambari-server.out 2>&1
> INFO: Return code from schema upgrade command, retcode = 1
> Error output from schema upgrade command:
> Exception in thread "main" org.apache.ambari.server.AmbariException: Cannot 
> add foreign key constraint
>       at 
> org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:204)
>       at 
> org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:302)
> Caused by: java.sql.SQLException: Cannot add foreign key constraint
>       at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:959)
>       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3870)
>       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3806)
>       at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2470)
>       at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2617)
>       at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2546)
>       at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2504)
>       at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:840)
>       at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:740)
>       at 
> org.apache.ambari.server.orm.DBAccessorImpl.executeQuery(DBAccessorImpl.java:800)
>       at 
> org.apache.ambari.server.orm.DBAccessorImpl.addFKConstraint(DBAccessorImpl.java:470)
>       at 
> org.apache.ambari.server.orm.DBAccessorImpl.addFKConstraint(DBAccessorImpl.java:435)
>       at 
> org.apache.ambari.server.upgrade.UpgradeCatalog240.createServiceComponentHistoryTable(UpgradeCatalog240.java:1375)
>       at 
> org.apache.ambari.server.upgrade.UpgradeCatalog240.executeDDLUpdates(UpgradeCatalog240.java:239)
>       at 
> org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.upgradeSchema(AbstractUpgradeCatalog.java:656)
>       at 
> org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:201)
>       ... 1 more
> ERROR: Error executing schema upgrade, please check the server logs.
> ERROR: Ambari server upgrade failed. Please look at 
> /var/log/ambari-server/ambari-server.log, for more details.
> ERROR: Exiting with exit code 11. 
> REASON: Schema upgrade failed.
> {code}
> ambari-server.log:
> {code}
> 19 May 2016 09:55:53,249  INFO [main] DBAccessorImpl:522 - Unique constraint 
> unq_scdesiredstate_name already exists or columns component_name, 
> service_name, cluster_id not found, skipping
> 19 May 2016 09:55:53,423  INFO [main] DBAccessorImpl:480 - Foreign Key 
> constraint hstcmpnntdesiredstatecmpnntnme already exists, skipping
> 19 May 2016 09:55:53,583  INFO [main] DBAccessorImpl:480 - Foreign Key 
> constraint hstcomponentstatecomponentname already exists, skipping
> 19 May 2016 09:55:53,585  WARN [main] AbstractUpgradeCatalog:143 - Sequence 
> servicecomponentdesiredstate_id_seq already exists, skipping
> 19 May 2016 09:55:53,589  WARN [main] DBAccessorImpl:532 - Primary constraint 
> PK_sc_history not altered to table servicecomponent_history as column [id] 
> not present or constraint already exists
> 19 May 2016 09:55:53,797  INFO [main] DBAccessorImpl:797 - Executing query: 
> ALTER TABLE servicecomponent_history ADD CONSTRAINT 
> FK_sc_history_component_id FOREIGN KEY (component_id) REFERENCES 
> servicecomponentdesiredstate (id)
> 19 May 2016 09:55:53,823 ERROR [main] DBAccessorImpl:803 - Error executing 
> query: ALTER TABLE servicecomponent_history ADD CONSTRAINT 
> FK_sc_history_component_id FOREIGN KEY (component_id) REFERENCES 
> servicecomponentdesiredstate (id)
> java.sql.SQLException: Cannot add foreign key constraint
>       at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:959)
>       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3870)
>       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3806)
>       at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2470)
>       at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2617)
>       at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2546)
>       at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2504)
>       at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:840)
>       at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:740)
>       at 
> org.apache.ambari.server.orm.DBAccessorImpl.executeQuery(DBAccessorImpl.java:800)
>       at 
> org.apache.ambari.server.orm.DBAccessorImpl.addFKConstraint(DBAccessorImpl.java:470)
>       at 
> org.apache.ambari.server.orm.DBAccessorImpl.addFKConstraint(DBAccessorImpl.java:435)
>       at 
> org.apache.ambari.server.upgrade.UpgradeCatalog240.createServiceComponentHistoryTable(UpgradeCatalog240.java:1375)
>       at 
> org.apache.ambari.server.upgrade.UpgradeCatalog240.executeDDLUpdates(UpgradeCatalog240.java:239)
>       at 
> org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.upgradeSchema(AbstractUpgradeCatalog.java:656)
>       at 
> org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:201)
>       at 
> org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:302)
> 19 May 2016 09:55:53,825  WARN [main] DBAccessorImpl:472 - Add FK constraint 
> failed, constraintName = FK_sc_history_component_id, tableName = 
> servicecomponent_history
> 19 May 2016 09:55:53,825 ERROR [main] SchemaUpgradeHelper:203 - Upgrade 
> failed. 
> java.sql.SQLException: Cannot add foreign key constraint
>       at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:959)
>       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3870)
>       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3806)
>       at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2470)
>       at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2617)
>       at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2546)
>       at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2504)
>       at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:840)
>       at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:740)
>       at 
> org.apache.ambari.server.orm.DBAccessorImpl.executeQuery(DBAccessorImpl.java:800)
>       at 
> org.apache.ambari.server.orm.DBAccessorImpl.addFKConstraint(DBAccessorImpl.java:470)
>       at 
> org.apache.ambari.server.orm.DBAccessorImpl.addFKConstraint(DBAccessorImpl.java:435)
>       at 
> org.apache.ambari.server.upgrade.UpgradeCatalog240.createServiceComponentHistoryTable(UpgradeCatalog240.java:1375)
>       at 
> org.apache.ambari.server.upgrade.UpgradeCatalog240.executeDDLUpdates(UpgradeCatalog240.java:239)
>       at 
> org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.upgradeSchema(AbstractUpgradeCatalog.java:656)
>       at 
> org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:201)
>       at 
> org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:302)
> 19 May 2016 09:55:53,826 ERROR [main] SchemaUpgradeHelper:319 - Exception 
> occurred during upgrade, failed
> org.apache.ambari.server.AmbariException: Cannot add foreign key constraint
>       at 
> org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:204)
>       at 
> org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:302)
> Caused by: java.sql.SQLException: Cannot add foreign key constraint
>       at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:959)
>       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3870)
>       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3806)
>       at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2470)
>       at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2617)
>       at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2546)
>       at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2504)
>       at com.mysql.jdbc.StatementImpl.executeInternal(StatementImpl.java:840)
>       at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:740)
>       at 
> org.apache.ambari.server.orm.DBAccessorImpl.executeQuery(DBAccessorImpl.java:800)
>       at 
> org.apache.ambari.server.orm.DBAccessorImpl.addFKConstraint(DBAccessorImpl.java:470)
>       at 
> org.apache.ambari.server.orm.DBAccessorImpl.addFKConstraint(DBAccessorImpl.java:435)
>       at 
> org.apache.ambari.server.upgrade.UpgradeCatalog240.createServiceComponentHistoryTable(UpgradeCatalog240.java:1375)
>       at 
> org.apache.ambari.server.upgrade.UpgradeCatalog240.executeDDLUpdates(UpgradeCatalog240.java:239)
>       at 
> org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.upgradeSchema(AbstractUpgradeCatalog.java:656)
>       at 
> org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:201)
>       ... 1 more
> {code}
> *Issue was not present in :*
> {code}
> 2.4.0.0-569
> 862d548c9b1c88bf70bf9f630bdd99ea4bb66211
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to