Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-12520

ambari-server upgrade from 2.0.1 to 2.1.0 failed in postgres while deleting foreign keys

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 2.1.0
    • 2.1.1
    • ambari-server
    • None

    Description

      This was reported by the community:

      Hi,
      
      I have a issue with upgrade from Ambari 2.0.1 to 2.1.0, I changed the JDK from 1.6 to 1.7 from “ambari-server setup”. When I do “ambari-server upgrade”, the result is:
      
      Using python /usr/bin/python2.6
      Upgrading ambari-server
      Updating properties in ambari.properties …
      WARNING: Can not find ambari.properties.rpmsave file from previous version, skipping import of settings
      Fixing database objects owner
      Upgrading database schema
      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.
      
      When I see the /var/log/ambari-server/ambari-server.log:
      
      23 Jul 2015 11:37:15,724 INFO [main] Configuration:594 – Reading password from existing file
      23 Jul 2015 11:37:15,738 INFO [main] Configuration:864 – Hosts Mapping File null
      23 Jul 2015 11:37:15,738 INFO [main] HostsMap:60 – Using hostsmap file null
      23 Jul 2015 11:37:16,229 INFO [main] ControllerModule:185 – Detected POSTGRES as the database type from the JDBC URL
      23 Jul 2015 11:37:17,669 INFO [main] ControllerModule:558 – Binding and registering notification dispatcher class org.apache.ambari.server.notifications.dispatchers.AlertScriptDispatcher
      23 Jul 2015 11:37:17,677 INFO [main] ControllerModule:558 – Binding and registering notification dispatcher class org.apache.ambari.server.notifications.dispatchers.EmailDispatcher
      23 Jul 2015 11:37:17,731 INFO [main] ControllerModule:558 – Binding and registering notification dispatcher class org.apache.ambari.server.notifications.dispatchers.SNMPDispatcher
      23 Jul 2015 11:37:20,479 INFO [main] SchemaUpgradeHelper:277 – Upgrading schema to target version = 2.1.0
      23 Jul 2015 11:37:20,500 INFO [main] SchemaUpgradeHelper:286 – Upgrading schema from source version = 2.0.1
      23 Jul 2015 11:37:20,502 INFO [main] SchemaUpgradeHelper:150 – Upgrade path: [{ upgradeCatalog: sourceVersion = 2.0.0, targetVersion = 2.1.0 }, { upgradeCatalog: sourceVersion = null, targetVersion = 2.1.0 }]
      23 Jul 2015 11:37:20,502 INFO [main] SchemaUpgradeHelper:185 – Executing DDL upgrade…
      23 Jul 2015 11:37:20,502 INFO [main] DBAccessorImpl:691 – Executing query: ALTER SCHEMA ambari OWNER TO “ambari”;
      23 Jul 2015 11:37:20,503 INFO [main] DBAccessorImpl:691 – Executing query: ALTER ROLE “ambari” SET search_path to ‘ambari';
      23 Jul 2015 11:37:20,506 INFO [main] DBAccessorImpl:691 – Executing query: ALTER TABLE alert_current ALTER COLUMN latest_text TYPE TEXT
      23 Jul 2015 11:37:20,516 INFO [main] DBAccessorImpl:691 – Executing query: ALTER TABLE alert_history ALTER COLUMN alert_text TYPE TEXT
      23 Jul 2015 11:37:20,582 INFO [main] DBAccessorImpl:691 – Executing query: UPDATE hosts SET host_id = 1 WHERE host_name = ‘hm1.clapix.com’
      23 Jul 2015 11:37:20,585 INFO [main] DBAccessorImpl:691 – Executing query: UPDATE hosts SET host_id = 2 WHERE host_name = ‘hm2.clapix.com’
      23 Jul 2015 11:37:20,586 INFO [main] DBAccessorImpl:691 – Executing query: UPDATE hosts SET host_id = 3 WHERE host_name = ‘hs1.clapix.com’
      23 Jul 2015 11:37:20,586 INFO [main] DBAccessorImpl:691 – Executing query: UPDATE hosts SET host_id = 4 WHERE host_name = ‘hs2.clapix.com’
      23 Jul 2015 11:37:20,587 INFO [main] DBAccessorImpl:691 – Executing query: UPDATE hosts SET host_id = 5 WHERE host_name = ‘hs3.clapix.com’
      23 Jul 2015 11:37:20,588 INFO [main] DBAccessorImpl:691 – Executing query: UPDATE hosts SET host_id = 6 WHERE host_name = ‘hs4.clapix.com’
      23 Jul 2015 11:37:20,589 INFO [main] DBAccessorImpl:691 – Executing query: UPDATE hosts SET host_id = 7 WHERE host_name = ‘hs5.clapix.com’
      23 Jul 2015 11:37:20,590 INFO [main] DBAccessorImpl:691 – Executing query: UPDATE hosts SET host_id = 8 WHERE host_name = ‘hs6.clapix.com’
      23 Jul 2015 11:37:20,590 INFO [main] DBAccessorImpl:691 – Executing query: UPDATE hosts SET host_id = 9 WHERE host_name = ‘hs7.clapix.com’
      23 Jul 2015 11:37:20,592 WARN [main] AbstractUpgradeCatalog:140 – Sequence host_id_seq already exists, skipping
      23 Jul 2015 11:37:20,592 INFO [main] DBAccessorImpl:691 – Executing query: ALTER TABLE hosts ALTER COLUMN host_id TYPE BIGINT
      23 Jul 2015 11:37:20,621 WARN [main] DBAccessorImpl:288 – FK hostcomponentstate_host_name not found for table hostcomponentstate
      23 Jul 2015 11:37:20,621 WARN [main] DBAccessorImpl:748 – Constraint hostcomponentstate_host_name from hostcomponentstate table not found, nothing to drop
      23 Jul 2015 11:37:20,640 WARN [main] DBAccessorImpl:288 – FK fk_hostcomponentstate_host_name not found for table hostcomponentstate
      23 Jul 2015 11:37:20,640 WARN [main] DBAccessorImpl:748 – Constraint fk_hostcomponentstate_host_name from hostcomponentstate table not found, nothing to drop
      23 Jul 2015 11:37:20,657 WARN [main] DBAccessorImpl:288 – FK hstcmponentdesiredstatehstname not found for table hostcomponentdesiredstate
      23 Jul 2015 11:37:20,658 WARN [main] DBAccessorImpl:748 – Constraint hstcmponentdesiredstatehstname from hostcomponentdesiredstate table not found, nothing to drop
      23 Jul 2015 11:37:20,673 WARN [main] DBAccessorImpl:288 – FK fk_hostcomponentdesiredstate_host_name not found for table hostcomponentdesiredstate
      23 Jul 2015 11:37:20,673 WARN [main] DBAccessorImpl:748 – Constraint fk_hostcomponentdesiredstate_host_name from hostcomponentdesiredstate table not found, nothing to drop
      23 Jul 2015 11:37:20,690 WARN [main] DBAccessorImpl:288 – FK fk_host_role_command_host_name not found for table host_role_command
      23 Jul 2015 11:37:20,690 WARN [main] DBAccessorImpl:748 – Constraint FK_host_role_command_host_name from host_role_command table not found, nothing to drop
      23 Jul 2015 11:37:20,704 WARN [main] DBAccessorImpl:288 – FK fk_hoststate_host_name not found for table hoststate
      23 Jul 2015 11:37:20,704 WARN [main] DBAccessorImpl:748 – Constraint FK_hoststate_host_name from hoststate table not found, nothing to drop
      23 Jul 2015 11:37:20,718 WARN [main] DBAccessorImpl:288 – FK fk_host_version_host_name not found for table host_version
      23 Jul 2015 11:37:20,718 WARN [main] DBAccessorImpl:748 – Constraint FK_host_version_host_name from host_version table not found, nothing to drop
      23 Jul 2015 11:37:20,732 WARN [main] DBAccessorImpl:288 – FK fk_cghm_hname not found for table configgrouphostmapping
      23 Jul 2015 11:37:20,732 WARN [main] DBAccessorImpl:748 – Constraint FK_cghm_hname from configgrouphostmapping table not found, nothing to drop
      23 Jul 2015 11:37:20,746 WARN [main] DBAccessorImpl:288 – FK fk_configgrouphostmapping_host_name not found for table configgrouphostmapping
      23 Jul 2015 11:37:20,746 WARN [main] DBAccessorImpl:748 – Constraint fk_configgrouphostmapping_host_name from configgrouphostmapping table not found, nothing to drop
      23 Jul 2015 11:37:20,759 WARN [main] DBAccessorImpl:288 – FK fk_krb_pr_host_hostname not found for table kerberos_principal_host
      23 Jul 2015 11:37:20,759 WARN [main] DBAccessorImpl:748 – Constraint FK_krb_pr_host_hostname from kerberos_principal_host table not found, nothing to drop
      23 Jul 2015 11:37:20,773 WARN [main] DBAccessorImpl:288 – FK fk_kerberos_principal_host_host_name not found for table kerberos_principal_host
      23 Jul 2015 11:37:20,774 WARN [main] DBAccessorImpl:748 – Constraint fk_kerberos_principal_host_host_name from kerberos_principal_host table not found, nothing to drop
      23 Jul 2015 11:37:20,789 WARN [main] DBAccessorImpl:288 – FK fk_krb_pr_host_principalname not found for table kerberos_principal_host
      23 Jul 2015 11:37:20,789 WARN [main] DBAccessorImpl:748 – Constraint FK_krb_pr_host_principalname from kerberos_principal_host table not found, nothing to drop
      23 Jul 2015 11:37:20,806 WARN [main] DBAccessorImpl:288 – FK fk_hostconfmapping_host_name not found for table hostconfigmapping
      23 Jul 2015 11:37:20,807 WARN [main] DBAccessorImpl:748 – Constraint FK_hostconfmapping_host_name from hostconfigmapping table not found, nothing to drop
      23 Jul 2015 11:37:20,820 WARN [main] DBAccessorImpl:288 – FK clusterhostmapping_host_name not found for table clusterhostmapping
      23 Jul 2015 11:37:20,820 WARN [main] DBAccessorImpl:748 – Constraint ClusterHostMapping_host_name from ClusterHostMapping table not found, nothing to drop
      23 Jul 2015 11:37:20,833 WARN [main] DBAccessorImpl:288 – FK fk_clusterhostmapping_host_name not found for table clusterhostmapping
      23 Jul 2015 11:37:20,833 WARN [main] DBAccessorImpl:748 – Constraint fk_clusterhostmapping_host_name from ClusterHostMapping table not found, nothing to drop
      23 Jul 2015 11:37:20,846 WARN [main] DBAccessorImpl:288 – FK clusterhostmapping_cluster_id not found for table clusterhostmapping
      23 Jul 2015 11:37:20,846 WARN [main] DBAccessorImpl:748 – Constraint ClusterHostMapping_cluster_id from ClusterHostMapping table not found, nothing to drop
      23 Jul 2015 11:37:20,859 INFO [main] DBAccessorImpl:422 – Foreign Key constraint FK_clhostmapping_cluster_id already exists, skipping
      23 Jul 2015 11:37:20,863 INFO [main] DBAccessorImpl:691 – Executing query: ALTER TABLE hosts DROP CONSTRAINT hosts_pkey
      23 Jul 2015 11:37:20,869 ERROR [main] DBAccessorImpl:697 – Error executing query: ALTER TABLE hosts DROP CONSTRAINT hosts_pkey
      org.postgresql.util.PSQLException: ERROR: cannot drop constraint hosts_pkey on table hosts because other objects depend on it
      Detail: constraint fk_hostconfigmapping_host_name on table hostconfigmapping depends on index hosts_pkey
      Hint: Use DROP … CASCADE to drop the dependent objects too.
      at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161)
      at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890)
      at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
      at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:559)
      at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:403)
      at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:395)
      at org.apache.ambari.server.orm.DBAccessorImpl.executeQuery(DBAccessorImpl.java:694)
      at org.apache.ambari.server.orm.DBAccessorImpl.dropPKConstraint(DBAccessorImpl.java:771)
      at org.apache.ambari.server.upgrade.UpgradeCatalog210.executeHostsDDLUpdates(UpgradeCatalog210.java:425)
      at org.apache.ambari.server.upgrade.UpgradeCatalog210.executeDDLUpdates(UpgradeCatalog210.java:190)
      at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.upgradeSchema(AbstractUpgradeCatalog.java:526)
      at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:190)
      at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:291)
      23 Jul 2015 11:37:20,871 ERROR [main] SchemaUpgradeHelper:192 – Upgrade failed.
      org.postgresql.util.PSQLException: ERROR: cannot drop constraint hosts_pkey on table hosts because other objects depend on it
      Detail: constraint fk_hostconfigmapping_host_name on table hostconfigmapping depends on index hosts_pkey
      Hint: Use DROP … CASCADE to drop the dependent objects too.
      at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161)
      at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890)
      at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
      at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:559)
      at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:403)
      at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:395)
      at org.apache.ambari.server.orm.DBAccessorImpl.executeQuery(DBAccessorImpl.java:694)
      at org.apache.ambari.server.orm.DBAccessorImpl.dropPKConstraint(DBAccessorImpl.java:771)
      at org.apache.ambari.server.upgrade.UpgradeCatalog210.executeHostsDDLUpdates(UpgradeCatalog210.java:425)
      at org.apache.ambari.server.upgrade.UpgradeCatalog210.executeDDLUpdates(UpgradeCatalog210.java:190)
      at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.upgradeSchema(AbstractUpgradeCatalog.java:526)
      at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:190)
      at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:291)
      23 Jul 2015 11:37:20,871 ERROR [main] SchemaUpgradeHelper:308 – Exception occurred during upgrade, failed
      org.apache.ambari.server.AmbariException: ERROR: cannot drop constraint hosts_pkey on table hosts because other objects depend on it
      Detail: constraint fk_hostconfigmapping_host_name on table hostconfigmapping depends on index hosts_pkey
      Hint: Use DROP … CASCADE to drop the dependent objects too.
      at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:193)
      at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:291)
      Caused by: org.postgresql.util.PSQLException: ERROR: cannot drop constraint hosts_pkey on table hosts because other objects depend on it
      Detail: constraint fk_hostconfigmapping_host_name on table hostconfigmapping depends on index hosts_pkey
      Hint: Use DROP … CASCADE to drop the dependent objects too.
      at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161)
      at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890)
      at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
      at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:559)
      at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:403)
      at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:395)
      at org.apache.ambari.server.orm.DBAccessorImpl.executeQuery(DBAccessorImpl.java:694)
      at org.apache.ambari.server.orm.DBAccessorImpl.dropPKConstraint(DBAccessorImpl.java:771)
      at org.apache.ambari.server.upgrade.UpgradeCatalog210.executeHostsDDLUpdates(UpgradeCatalog210.java:425)
      at org.apache.ambari.server.upgrade.UpgradeCatalog210.executeDDLUpdates(UpgradeCatalog210.java:190)
      at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.upgradeSchema(AbstractUpgradeCatalog.java:526)
      at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:190)
      … 1 more
      

      Attachments

        1. AMBARI-12520.patch
          11 kB
          Alejandro Fernandez
        2. AMBARI-12520.branch-2.1.1.patch
          11 kB
          Alejandro Fernandez

        Issue Links

          Activity

            People

              afernandez Alejandro Fernandez
              afernandez Alejandro Fernandez
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: